FlexGrid for WinForms
Applying a Gradient Background to a CellRange
Show AllShow All
Hide AllHide All

To apply a gradient background to a CellRange, use the OwnerDrawCell event to create custom cell painting.

  1. Create a LinearGradient brush and a CellRange by adding the following code to the form class level:

    To write code in Visual Basic

    To write code in C#

  2. Set C1FlexGrid's DrawMode property to OwnerDraw by adding the following code to the Form_Load event:

    To write code in Visual Basic

    To write code in C#

  3. Set the CellRange using the GetCellRange method:

    To write code in Visual Basic

    To write code in C#

  4. Set the LinearGradient brush colors and angle of the gradient:

    To write code in Visual Basic

    To write code in C#

  5. Add the OwnerDrawCell event to draw the gradient in the CellRange:

    To write code in Visual Basic

    To write code in C#

This topic illustrates the following:

The Transparent to Navy gradient background appears only in the CellRange.


 

 


Copyright © GrapeCity, inc. All rights reserved.

Product Support Forum |  Documentation Feedback