ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

Expanding or Shrinking Columns During Grid Resizing

To expand or shrink columns during grid resizing, set the SpringMode property to True and the MinWidth property for each column. This can be done either in the designer or in code.

In the Designer

1.   Open the TrueDBGrid Designer. For information on how to access the TrueDBGrid Designer, see Accessing the TrueDBGrid Designer.

2.   Click the Split tab in the left pane.

3.   Locate the SpringMode property and set it to True.

Alternatively, the SpringMode property can also be in the Properties window.

4.   Select the First column in the right pane by clicking on it.

The column can also be selected by choosing First from the drop-down list in the toolbar.

5.   Click on the Display Column tab in the left pane.

6.   Locate the MinWidth property and set it to 50.

7.   Click OK to close the designer.

In Code

1.   Set the SpringMode property to True by adding the following code to the Form_Load event:

·      Visual Basic

Me.C1TrueDBGrid1.SpringMode = True

·      C#

this.c1TrueDBGrid1.SpringMode = true;

·      Delphi

Self.C1TrueDBGrid1.SpringMode := True;

2.   Set the MinWidth property to 50 for the First column:

·      Visual Basic

Me.C1TrueDBGrid1.Splits(0).DisplayColumns("First").MinWidth = 50

·      C#

this.c1TrueDBGrid1.Splits[0].DisplayColumns["First"].MinWidth = 50;

·      Delphi

Self.C1TrueDBGrid1.Splits[0].DisplayColumns["First"].MinWidth := 50;

This topic illustrates the following:

When the grid is resized horizontally, the columns will expand or shrink proportionally, except for the First column which will only shrink to 50.


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.