PathGradientBrush Class

 

Encapsulates a Brush object that fills the interior of a GraphicsPath object with a gradient. This class cannot be inherited.

Namespace:   System.Drawing.Drawing2D
Assembly:  System.Drawing (in System.Drawing.dll)

System.Object
  System.MarshalByRefObject
    System.Drawing.Brush
      System.Drawing.Drawing2D.PathGradientBrush

public sealed class PathGradientBrush : Brush

NameDescription
System_CAPS_pubmethodPathGradientBrush(GraphicsPath)

Initializes a new instance of the PathGradientBrush class with the specified path.

System_CAPS_pubmethodPathGradientBrush(Point[])

Initializes a new instance of the PathGradientBrush class with the specified points.

System_CAPS_pubmethodPathGradientBrush(Point[], WrapMode)

Initializes a new instance of the PathGradientBrush class with the specified points and wrap mode.

System_CAPS_pubmethodPathGradientBrush(PointF[])

Initializes a new instance of the PathGradientBrush class with the specified points.

System_CAPS_pubmethodPathGradientBrush(PointF[], WrapMode)

Initializes a new instance of the PathGradientBrush class with the specified points and wrap mode.

NameDescription
System_CAPS_pubpropertyBlend

Gets or sets a Blend that specifies positions and factors that define a custom falloff for the gradient.

System_CAPS_pubpropertyCenterColor

Gets or sets the color at the center of the path gradient.

System_CAPS_pubpropertyCenterPoint

Gets or sets the center point of the path gradient.

System_CAPS_pubpropertyFocusScales

Gets or sets the focus point for the gradient falloff.

System_CAPS_pubpropertyInterpolationColors

Gets or sets a ColorBlend that defines a multicolor linear gradient.

System_CAPS_pubpropertyRectangle

Gets a bounding rectangle for this PathGradientBrush.

System_CAPS_pubpropertySurroundColors

Gets or sets an array of colors that correspond to the points in the path this PathGradientBrush fills.

System_CAPS_pubpropertyTransform

Gets or sets a copy of the Matrix that defines a local geometric transform for this PathGradientBrush.

System_CAPS_pubpropertyWrapMode

Gets or sets a WrapMode that indicates the wrap mode for this PathGradientBrush.

NameDescription
System_CAPS_pubmethodClone()

Creates an exact copy of this PathGradientBrush.(Overrides Brush.Clone().)

System_CAPS_pubmethodCreateObjRef(Type)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodDispose()

Releases all resources used by this Brush object.(Inherited from Brush.)

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetLifetimeService()

Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodInitializeLifetimeService()

Obtains a lifetime service object to control the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodMultiplyTransform(Matrix)

Updates the brush's transformation matrix with the product of brush's transformation matrix multiplied by another matrix.

System_CAPS_pubmethodMultiplyTransform(Matrix, MatrixOrder)

Updates the brush's transformation matrix with the product of the brush's transformation matrix multiplied by another matrix.

System_CAPS_pubmethodResetTransform()

Resets the Transform property to identity.

System_CAPS_pubmethodRotateTransform(Single)

Rotates the local geometric transform by the specified amount. This method prepends the rotation to the transform.

System_CAPS_pubmethodRotateTransform(Single, MatrixOrder)

Rotates the local geometric transform by the specified amount in the specified order.

System_CAPS_pubmethodScaleTransform(Single, Single)

Scales the local geometric transform by the specified amounts. This method prepends the scaling matrix to the transform.

System_CAPS_pubmethodScaleTransform(Single, Single, MatrixOrder)

Scales the local geometric transform by the specified amounts in the specified order.

System_CAPS_pubmethodSetBlendTriangularShape(Single)

Creates a gradient with a center color and a linear falloff to one surrounding color.

System_CAPS_pubmethodSetBlendTriangularShape(Single, Single)

Creates a gradient with a center color and a linear falloff to each surrounding color.

System_CAPS_protmethodSetNativeBrush(IntPtr)

In a derived class, sets a reference to a GDI+ brush object. (Inherited from Brush.)

System_CAPS_pubmethodSetSigmaBellShape(Single)

Creates a gradient brush that changes color starting from the center of the path outward to the path's boundary. The transition from one color to another is based on a bell-shaped curve.

System_CAPS_pubmethodSetSigmaBellShape(Single, Single)

Creates a gradient brush that changes color starting from the center of the path outward to the path's boundary. The transition from one color to another is based on a bell-shaped curve.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_pubmethodTranslateTransform(Single, Single)

Applies the specified translation to the local geometric transform. This method prepends the translation to the transform.

System_CAPS_pubmethodTranslateTransform(Single, Single, MatrixOrder)

Applies the specified translation to the local geometric transform in the specified order.

The color gradient is a smooth shading of colors from the center point of the path to the outside boundary edge of the path. Blend factors, positions, and style affect where the gradient starts and ends, and how fast it changes shade.

Path gradient brushes do not obey the SmoothingMode property of the Graphics object used to do the drawing. Areas filled using a PathGradientBrush object are rendered the same way (aliased) regardless of the smoothing mode.

The following code example shows how to create a PathGradientBrush. This example is designed for use with Windows Forms, and it requires the PaintEventArgs e, which is a parameter of PaintEventHandler.

// Create a path that consists of a single ellipse.
GraphicsPath path = new GraphicsPath();
path.AddEllipse(0, 0, 140, 70);

// Use the path to construct a brush.
PathGradientBrush pthGrBrush = new PathGradientBrush(path);

// Set the color at the center of the path to blue.
pthGrBrush.CenterColor = Color.FromArgb(255, 0, 0, 255);

// Set the color along the entire boundary 
// of the path to aqua.
Color[] colors = { Color.FromArgb(255, 0, 255, 255) };
pthGrBrush.SurroundColors = colors;

e.Graphics.FillEllipse(pthGrBrush, 0, 0, 140, 70);

.NET Framework
Available since 1.1

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: