The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
Hi,
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!
Christian
ADAdministrator 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.