AD
Administrator
Syncfusion Team
May 5, 2005 08:06 PM UTC
To hook into the standard autosize (through grid.model.ColWidths.ResizeToFit), you can have your derived cellmodel class override CalculatePreferredCellSize and return the optimal size for your cell there. ColWidths.ResizeToFit will call this method when it needs to size your cell.
If you have our source code, you can look at different override of this method to see how the grid source does this calculation. The grid does use this helper method, Syncfusion.Windows.Forms.WinFormsUtils.MeasureSampleWString, to do its calculations.