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

Grid Column Width Units

Thread ID:





55205 Jan 25,2007 12:24 AM UTC Jan 25,2007 05:02 PM UTC WinForms 1
Tags: GridControl
Julie Levy
Asked On January 25, 2007 12:24 AM UTC

Hi -
Is there a way to get the measure of the gridcontrol's column widths in absolute length units like points (pt) or inches (in) instead of pixels?

Administrator [Syncfusion]
Replied On January 25, 2007 05:02 PM UTC

Hi Julie,

By default, The colwidth is in pixels. If you want to get the colwidth in inch, you can use graphics.DpiX property to covert the colwidth in inch. Below is a code snippet to show this.

private double GetColWidthInches(GridControl grid, int ColIndex)
int pixelWidth = grid.GetColWidth(ColIndex);
Graphics g = grid.CreateGridGraphics();//Disposed automatically.
double InchWidth = pixelWidth/g.DpiX;
return InchWidth;

If you want to get the cell bounds in a grid, you can use the Renderer.GetCellBoundsCore method. Here is a code snippet.

private Rectangle GetColRectangle(GridControl grid, int ColIndex)
Rectangle originalInvertBarBounds = grid.GetCellRenderer(0,ColIndex).GetCellBoundsCore(0,ColIndex);
return originalInvertBarBounds;

Best Regards,


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