Xceed Chart for WinForms v4.4 Documentation
Pattern

Welcome to Xceed Chart for WinForms v4.4 > User Guide > Fill Effects > Pattern

Patterns are predefined textures which are generated by the control when the user requests them. Xceed Chart for WinForms supports over 50 types of Excel-like patterns. Applying patterns to FillEffect object is very easy and requires the same steps as applying gradients, for example. The shortcut function that will change the FillEffect type, pattern style, and pattern colors is SetPattern:

VB.NET  
fillEffect.SetPattern(HatchStyle.DarkHorizontal, Color.White, Color.Black)
C#  
fillEffect.SetPattern(HatchStyle.DarkHorizontal, Color.White, Color.Black);

This line of code will apply a pattern of black and white horizontal stripes. The following table lists the possible pattern styles: 

Percent 5 Wide Downward Diagonal Diagonal Brick
Percent 10 Wide Upward Diagonal Horizontal Brick
Percent 20 Light Vertical Weave
Percent 25 Light Horizontal Plaid
Percent 30 Narrow Vertical Divot
Percent 40 Narrow Horizontal Dotted Grid
Percent 50 Dark Vertical Dotted Diamond
Percent 60 Dark Horizontal Shingle
Percent 70 Dashed Downward Diagonal Trellis
Percent 75 Dashed Upward Diagonal Sphere
Percent 80 Dashed Horizontal Small Grid
Percent 90 Dashed Vertical Large Grid
Light Downward Diagonal Small Confetti Small Checker Board
Light Upward Diagonal Large Confetti Large Checker Board
Dark Downward Diagonal Zig Zag Outlined Diamond
Dark Upward Diagonal Wave Solid Diamond

The pattern type is defined with the help of the standard enumeration System.Drawing.Drawing2D.HatchStyle. To get the pattern constant you need, all you have to do is to add the words in the pattern name. For example, if you want to achieve a "Zig Zag" pattern you use the following:

VB.NET  
fillEffect.SetPattern(HatchStyle.ZigZag, Color.White, Color.Black)
C#  
fillEffect.SetPattern(HatchStyle.ZigZag, Color.White, Color.Black);

As we mentioned at the beginning of this topic, SetPattern is a shortcut function. You can achieve the same results with the following code:

VB.NET  

fillEffect.Type = FillEffectType.Pattern
fillEffect.HatchStyle = HatchStyle.ZigZag
fillEffect.BeginColor = Color.White
fillEffect.EndColor = Color.Black
C#  

fillEffect.Type = FillEffectType.Pattern;
fillEffect.HatchStyle = HatchStyle.ZigZag;
fillEffect.BeginColor = Color.White;
fillEffect.EndColor = Color.Black;

You should also know that patterns are treated like textures, internally. This is why you can apply advanced texture transformations to them. For more information, please read the Texture Mapping topic in this book.

Related Examples

Windows forms: Fill Effects\General

See Also

FillEffect | Xceed 3D Lighting Model | Working with Lights | Texture Mapping