I have a grid which has different length Column header names.Intially, when the grid is loaded all the columns get clustered and i have manually resize each column to view the contents. Also I cannot set the height and width of each column as there are more than 100 column on the grid.To avoid this i have used the following steps :
1. Created a range of all cells in Column header row.
2.Used RowHeights.ResizeToFit property.
>>Syncfusion.Windows.Forms.Grid.GridRangeInfo objGridInfo = new >>Syncfusion.Windows.Forms.Grid.GridRangeInfo();
objGridInfo =dgAnalysis.Model.Rows.CreateRangeFromTo(0,0); >>dgAnalysis.Model.RowHeights.ResizeToFit(objGridInfo,Syncfusion.Windows.Forms.Grid.GridResizeToFitOptions.IncludeHeaders) ;
But this code does not work always.
Can you suggest what is wrong in this code. And also if something else that i can try to solve the problem.
ADAdministrator Syncfusion Team July 26, 2004 03:24 AM
If this is a GridDataBoundGrid, in formload, also set grid.AllowResizeToFit = false. The reason is that if this is not set, the grid will try to set the colwidths itself, and this can ''step on'' the explicit sizing you want to do.
Not that I think it will make a difference, but you do not have to use a new operator to generate a GridRangeInfo object as the class has Static constructors that simpleify things in this respect. This single line can replace all teh code you listed.