Try this code.
//in form.Load
this.gridGroupingControl1.SizeChanged += new EventHandler(gridGroupingControl1_SizeChanged);
this.gridGroupingControl1.TableControl.Model.QueryColWidth += new GridRowColSizeEventHandler(grid_QueryColWidth);
this.SCROLLBARWIDTH = SystemInformation.VerticalScrollBarWidth;
//the event handlers
private int SCROLLBARWIDTH;
private void grid_QueryColWidth(object sender, GridRowColSizeEventArgs e)
{
int last = this.gridGroupingControl1.TableDescriptor.VisibleColumns.Count;
if(e.Index == last + this.gridGroupingControl1.TableDescriptor.GroupedColumns.Count)
{
int vscrollwidth = ((this.gridGroupingControl1.TableControl.Model.RowHeights.GetTotal(0, this.gridGroupingControl1.TableControl.Model.RowCount)
+ this.gridGroupingControl1.TableOptions.CaptionRowHeight)
> this.gridGroupingControl1.ClientSize.Height)
? SCROLLBARWIDTH :0;
e.Size = this.gridGroupingControl1.ClientSize.Width -
this.gridGroupingControl1.TableControl.Model.ColWidths.GetTotal(0, e.Index - 1)
- vscrollwidth;
e.Handled = true;
}
}
private void gridGroupingControl1_SizeChanged(object sender, EventArgs e)
{
this.gridGroupingControl1.Refresh();
}