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.

Grid Column Width Units

Thread ID:

Created:

Updated:

Platform:

Replies:

55205 Jan 24,2007 07:24 PM Jan 25,2007 12:02 PM Windows Forms 1
loading
Tags: GridControl
Julie Levy
Asked On January 24, 2007 07:24 PM

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?
Thanks,
Julie

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

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,
Haneef

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.

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.

;