I implemented a cell renderer to render a hierachical grid derived from GridTextBoxCellRenderer. Everything works fine so far. Now I want to determine the total width of each cell to implement autosize column. I use the graphics routines of the base class to support themded drawing and righttoleft.
Is there any method availabe to measure text width, checkbox width and so on?
Thanks in advance!
ADAdministrator Syncfusion Team May 5, 2005 03:06 PM
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.