TMSFMXGrid Vertical Scroll bar visible?

I'm using a TMSFMXGrid. I want to Autosize the columns so they fill whatever space is available to the grid. 


Right now I do this:
grdScenario.DefaultColumnWidth := Trunc(grdScenario.Width / grdScenario.ColumnCount);

This works great, except for the vertical scroll bar. I find that if it is showing, my size will be slightly off.

How could I get either the actual available width (without scroll bar) or the visibility/width of the scroll bar?



The actual available width without scrollbar is begin calculated based on the CellWrapper rectangle which can be retrieved with GetCellWrapper. You will have to calculate the DefaultColumnWidth twice, since the first time, it is based on an active scrollbar and afterwards the scrollbar is being set to visible because the total width of the cells do not exceed the grid boundaries.


  TMSFMXGrid1.BeginUpdate;
  TMSFMXGrid1.ColumnCount := 10;
  TMSFMXGrid1.RowCount := 10;
  TMSFMXGrid1.NeedStyleLookup;
  TMSFMXGrid1.ApplyStyleLookup;
  TMSFMXGrid1.DefaultColumnWidth := TMSFMXGrid1.GetCellWrapper.Width / TMSFMXGrid1.ColumnCount;
  TMSFMXGrid1.EndUpdate;
  TMSFMXGrid1.BeginUpdate;
  TMSFMXGrid1.DefaultColumnWidth := TMSFMXGrid1.GetCellWrapper.Width / TMSFMXGrid1.ColumnCount;
  TMSFMXGrid1.EndUpdate;

Kind Regards, 
Pieter

Thanks, that worked!