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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Measure cell content width in own cell renderer

Thread ID:





28639 May 5,2005 07:47 PM UTC May 5,2005 08:06 PM UTC WinForms 1
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.


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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