#215 – Other Choices for Gradient Spreads Outside the Fill Area

If a gradient fill has start/stop points that lie within the control, the fill behavior outside the gradient is dictated by the SpreadMethod property of the gradient brush.

In the example below, the gradient starts at X=0.33 and stops at X=0.67.  There are three different values that you can set SpreadMethod to, dictating how the control is filled at X < 0.33 and X > 0.67.

SpreadMethod = GradientSpreadMethod.Pad (the default).  The colors at each end of the gradient are used to fill the rest of the control.

SpreadMethod = GradientSpreadMethod.Reflect. The gradient repeats, reversing its direction, to fill the rest of the control.

SpreadMethod = GradientSpreadMethod.Repeat.  The gradient repeats, but in the original direction.  As much of the gradient as will fit is used.

 

 

Advertisements