Name
LinearGradientBrush
Synopsis
This brush class can be used to draw both two color and multicolor gradient fills.
For a two-color gradient, you set the LinearColors
and the Blend properties. For a multicolor
gradient, you instead set a ColorBlend object into
the InterpolationColors member. In either case,
you can enable GammaCorrection when rendering the
gradient.
You can specify the logical Rectangle that defines
the gradient, either in the constructor or, thereafter, through the
Rectangle property. If the fill extends beyond
this rectangle, the WrapMode determines how the
areas outside the rectangle will be filled. When constructing the
brush, but not thereafter, you can specify the
LinearGradientMode or, alternatively, the angle
(in degrees) at which the gradient should run across that rectangle.
You can also apply a Transform to the brush. There
are the usual helper utilities MultiplyTransform(), ResetTransform(),
RotateTransform(), TranslateTransform(), and ScaleTransform() to save you the
trouble of the get/modify/set required to modify the
Transform itself.
There are two other helper utilities:
SetBlendTriangularShape() and
SetSigmaBellShape() set up two common gradient
shapes for you.
For non-rectangular fills, see PathGradientBrush.
public sealed class LinearGradientBrush : System.Drawing.Brush { // Public Constructors public LinearGradientBrush(System.Drawing.PointF point1, System.Drawing.PointF point2, System.Drawing.Color color1, System.Drawing.Color color2); public LinearGradientBrush ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access