AD
Administrator
Syncfusion Team
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,
Haneef