ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

Adding a Gradient Fill to a Column

To add a gradient fill to a column, set the GradientMode, BackColor, and BackColor2 properties. Also, setting the GammaCorrection property to True to apply the gradient with a more uniform intensity. These properties can be set either in the designer or in code.

In the Designer

To set the gradient fill using the C1TrueDBGrid Tasks menu:

1.   Select the Last column in the grid and click it to open the C1TrueDBGrid Tasks menu.

2.   Select Column Style from the menu.

3.   Click the Fill Effects tab.

4.   Set BackColor 2 to Aqua.

5.   Set Gradient mode to ForwardDiagonal.

6.   Check the Gamma correction box.

7.   Click Ok to close the Column Style(Last) dialog.

Alternatively, the gradient fill can also be set through the TrueDBGrid Designer. To set the gradient fill using the designer:

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

 

2.   Select the Last column by clicking it in the right pane.

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

3.   Click the Display Column tab in the left pane.

4.   Click the ellipsis button next to the Style property to open the Style Editor.

5.   In the Style Editor, click the Fill Effects tab.

6.   Set BackColor 2 to Aqua.

7.   Set Gradient mode to ForwardDiagonal.

8.   Check the Gamma correction box.

9.   Click Ok to close the Style Editor.

10.  Click OK to close the TrueDBGrid Designer.

In Code

1.   Set GradientMode to ForwardDiagonal by adding the following code to the Form_Load event:

·      Visual Basic

Me.C1TrueDBGrid1.Splits(0).DisplayColumns("Last").Style.GradientMode = C1.Win.C1TrueDBGrid.GradientModeEnum.ForwardDiagonal

·      C#

this.c1TrueDBGrid1.Splits[0].DisplayColumns["Last"].Style.GradientMode = C1.Win.C1TrueDBGrid.GradientModeEnum.ForwardDiagonal;

·      Delphi

Self.C1TrueDBGrid1.Splits[0].DisplayColumns['Last'].Style.GradientMode := C1.Win.C1TrueDBGrid.GradientModeEnum.ForwardDiagonal;

2.   Set BackColor2 to Aqua:

·      Visual Basic

Me.C1TrueDBGrid1.Splits(0).DisplayColumns("Last").Style.BackColor2 = Color.Aqua

·      C#

this.c1TrueDBGrid1.Splits[0].DisplayColumns["Last"].Style.BackColor2 = Color.Aqua;

·      Delphi

Self.C1TrueDBGrid1.Splits[0].DisplayColumns['Last'].Style.BackColor2 := Color.Aqua;

3.   Set GammaCorrection to True:

·      Visual Basic

Me.C1TrueDBGrid1.Splits(0).DisplayColumns("Last").Style.GammaCorrection = True

·      C#

this.c1TrueDBGrid1.Splits[0].DisplayColumns["Last"].Style.GammaCorrection = true;

·      Delphi

Self.C1TrueDBGrid1.Splits[0].DisplayColumns['Last'].Style.GammaCorrection := True;

This topic illustrates the following:

The Last column has a white to aqua, forward diagonal gradient fill.


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