Professional User Interface Suite, Copyright FOSS Software Inc. Help Published with Permission.

You can set up your grid in a way that, regardless of it size, the columns will always take up the entire width of the grid's client area without displaying the horizontal scroll bar. To see how this works, run the ReportGrid sample and make sure that Report Grid | Behavior | Use Column Auto-Sizing is checked. To enable this option in your grid (any class derived from CExtGridWnd including CExtReportGrid), follow these steps:

1) Apply the __EGBS_BSE_EX_PROPORTIONAL_COLUMN_WIDTHS style to the grid window using the CExtGridWnd::BseModifyStyleEx() method.

2) Specify the weight of each column (i.e., how the column's width should change) using the CExtGridCell::ExtentPercentSet() method of the column header cell. The weight values should be in the range of 0.0 to 1.0.

3) Keep in mind that you can also set the initial, minimum, and maximum width for each column using the CExtGridCell::ExtentSet() of the header cell. The column will be not resizable at all, if these width values are equal to each other.