Framework / Presentation Layer / Graphics / Appearance Styles / Fill Styles / Gradient Fill Style

In This Topic
    Gradient Fill Style
    In This Topic

    The gradient fill style defines a filling based on a start and end color. To apply a gradient fill style on some object you must create an instance of the NGradientFillStyle class. For example:

    C#
    Copy Code
    someObject.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Black);
    
    Visual Basic
    Copy Code
    someObject.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Black)
    
     Gradient Colors
    There are two colors associated with each gradient - begin and end color. They can be controlled by the BeginColor and EndColor properties respectively.
     Gradient Style and Variant

    There are 6 predefined gradient styles, which are enumerated GradientStyle enumeration. Each of these styles can have up to four different variants (in fact only the FromCenter style supports only two variants). The gradient style is specified by the GradientStyle property, while its variant is defined by the Variant property.

    The following table shows the different gradient styles and variants for a gradient with a White begin and Black end color.

    Gradient Style Variant 1 Variant 2 Variant 3 Variant 4
    Horizontal
    Vertical
    Diagonal up
    Diagonal down
    From corner
    From center
    See Also