11123 : I want to extend the grid columns so that they always fill the space in grid

Question

 

How can I automatically extend the grid column to use up all the space in the grid?

 

Answer

 

Implement the Grid.Resize event and do something like this:

 

< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> 

    void Grid_Resize(object sender, EventArgs e)

    {

      if (gantt1.Grid.Columns.SumWidth()<gantt1.Grid.Width)

      {

        gantt1.Grid.Columns.FirstVisibleColumn().Width+=gantt1.Grid.Width-gantt1.Grid.Columns.SumWidth();

      }

    }