We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Measure cell content width in own cell renderer

Thread ID:

Created:

Updated:

Platform:

Replies:

28639 May 5,2005 07:47 PM UTC May 5,2005 08:06 PM UTC Windows Forms 1
loading
Tags: GridControl
Christian Rattat
Asked On May 5, 2005 07:47 PM UTC

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

Administrator [Syncfusion]
Replied On 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.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;