Home - Forums-.NET - FlyGrid.Net (Windows Forms) - Get grid size

FlyGrid.Net (Windows Forms)

.NET Datagrid - Fast, highly customizable, industry standards .NET data grid control for WinForms

This forum related to following products: FlyGrid.Net

Get grid size
Link Posted: 30-Oct-2005 21:48
Hi, I'm working with flygrid v1.1.4322 and i cant upgrade it for now.
the grid has property that called ActivePort, that contains a method that called getTotal size. in the firs use the method does exactly what i want: calculate the size that grid should be as if he didnt has any scroolbars.
if i for example open a node in the tree grid and the size is changing the GetTotalSize method still returns the previous value.
Is it a bug? Is there any other solution for me?

Thanks in advance,
Avi
Link Posted: 31-Oct-2005 06:06
To obtain flyGrid.ActivePort bounds extract from this object IObjectWithBounds interface:
private Rectangle GetBounds(FlyGrid flyGrid)
{
  IObjectWithBounds owb = flyGrid.ActivePort as IObjectWithBounds;
  return owb.Bounds;
}


Returned value doesn't reflect client size, to obtain client area use following code:
private Rectangle GetClientBounds(FlyGrid flyGrid)
{
  Rectangle bounds = GetBounds(flyGrid);
  if (flyGrid.ActivePort.HScrollBar.Visible)
    bounds.Height -= SystemInformation.HorizontalScrollBarHeight;    
  if (flyGrid.ActivePort.VScrollBar.Visible)
    bounds.Width -= SystemInformation.VerticalScrollBarWidth;
return bounds;
}