Home Forums WinForms controls Xceed Grid for WinForms How do I have a column fill remaining width? Reply To: How do I have a column fill remaining width?

User (Old forums)
Member
Post count: 23064

I was faced with similar problem before.
And If the VerticalScrollBar mentioned is applicable, here is how you detect if a vertical scroll bar is visible

foreach (Control c in _legendgridControl.Controls)
{
if (c.GetType().ToString() == “Xceed.Grid.Controls.WinVerticalScrollBar”)
{
return c.Visible;
}
}
return false;

You can not right (c is Xceed.Grid.Controls.WinVerticalScrollBar) because Xceed.Grid.Controls.WinVerticalScrollBar is internal.

The width of the scroll bar is SystemInformation.VerticalScrollBarWidth or you can also return it from the loop above as c.Width.

You may have to subscribe to teh visible changed event of teh scroll bar because it is usually shown after the resize event. In that case something like this will work,

foreach (Control scrollBar in _legendgridControl.Controls)
{
if (scrollBar.GetType().ToString() == “Xceed.Grid.Controls.WinVerticalScrollBar”)
{
scrollBar.VisibleChanged += new EventHandler(scrollBar_VisibleChanged);
}
}

Imported from legacy forums. Posted by userX (had 509 views)