Edit

Share via


LinearGradientBrush Constructors

Definition

Initializes a new instance of the LinearGradientBrush class with the specified points and colors.

Overloads

LinearGradientBrush(Point, Point, Color, Color)

Initializes a new instance of the LinearGradientBrush class with the specified points and colors.

LinearGradientBrush(PointF, PointF, Color, Color)

Initializes a new instance of the LinearGradientBrush class with the specified points and colors.

LinearGradientBrush(Rectangle, Color, Color, LinearGradientMode)

Creates a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and orientation.

LinearGradientBrush(Rectangle, Color, Color, Single)

Creates a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and an orientation angle.

LinearGradientBrush(RectangleF, Color, Color, LinearGradientMode)

Creates a new instance of the LinearGradientBrush based on a rectangle, starting and ending colors, and an orientation mode.

LinearGradientBrush(RectangleF, Color, Color, Single)

Creates a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and an orientation angle.

LinearGradientBrush(Rectangle, Color, Color, Single, Boolean)

Creates a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and an orientation angle.

LinearGradientBrush(RectangleF, Color, Color, Single, Boolean)

Creates a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and an orientation angle.

LinearGradientBrush(Point, Point, Color, Color)

Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs

Initializes a new instance of the LinearGradientBrush class with the specified points and colors.

public:
 LinearGradientBrush(System::Drawing::Point point1, System::Drawing::Point point2, System::Drawing::Color color1, System::Drawing::Color color2);
public LinearGradientBrush (System.Drawing.Point point1, System.Drawing.Point point2, System.Drawing.Color color1, System.Drawing.Color color2);
new System.Drawing.Drawing2D.LinearGradientBrush : System.Drawing.Point * System.Drawing.Point * System.Drawing.Color * System.Drawing.Color -> System.Drawing.Drawing2D.LinearGradientBrush
Public Sub New (point1 As Point, point2 As Point, color1 As Color, color2 As Color)

Parameters

point1
Point

A Point structure that represents the starting point of the linear gradient.

point2
Point

A Point structure that represents the endpoint of the linear gradient.

color1
Color

A Color structure that represents the starting color of the linear gradient.

color2
Color

A Color structure that represents the ending color of the linear gradient.

Applies to

LinearGradientBrush(PointF, PointF, Color, Color)

Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs

Initializes a new instance of the LinearGradientBrush class with the specified points and colors.

public:
 LinearGradientBrush(System::Drawing::PointF point1, System::Drawing::PointF point2, System::Drawing::Color color1, System::Drawing::Color color2);
public LinearGradientBrush (System.Drawing.PointF point1, System.Drawing.PointF point2, System.Drawing.Color color1, System.Drawing.Color color2);
new System.Drawing.Drawing2D.LinearGradientBrush : System.Drawing.PointF * System.Drawing.PointF * System.Drawing.Color * System.Drawing.Color -> System.Drawing.Drawing2D.LinearGradientBrush
Public Sub New (point1 As PointF, point2 As PointF, color1 As Color, color2 As Color)

Parameters

point1
PointF

A PointF structure that represents the starting point of the linear gradient.

point2
PointF

A PointF structure that represents the endpoint of the linear gradient.

color1
Color

A Color structure that represents the starting color of the linear gradient.

color2
Color

A Color structure that represents the ending color of the linear gradient.

Applies to

LinearGradientBrush(Rectangle, Color, Color, LinearGradientMode)

Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs

Creates a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and orientation.

public:
 LinearGradientBrush(System::Drawing::Rectangle rect, System::Drawing::Color color1, System::Drawing::Color color2, System::Drawing::Drawing2D::LinearGradientMode linearGradientMode);
public LinearGradientBrush (System.Drawing.Rectangle rect, System.Drawing.Color color1, System.Drawing.Color color2, System.Drawing.Drawing2D.LinearGradientMode linearGradientMode);
new System.Drawing.Drawing2D.LinearGradientBrush : System.Drawing.Rectangle * System.Drawing.Color * System.Drawing.Color * System.Drawing.Drawing2D.LinearGradientMode -> System.Drawing.Drawing2D.LinearGradientBrush
Public Sub New (rect As Rectangle, color1 As Color, color2 As Color, linearGradientMode As LinearGradientMode)

Parameters

rect
Rectangle

A Rectangle structure that specifies the bounds of the linear gradient.

color1
Color

A Color structure that represents the starting color for the gradient.

color2
Color

A Color structure that represents the ending color for the gradient.

linearGradientMode
LinearGradientMode

A LinearGradientMode enumeration element that specifies the orientation of the gradient. The orientation determines the starting and ending points of the gradient. For example, LinearGradientMode.ForwardDiagonal specifies that the starting point is the upper-left corner of the rectangle and the ending point is the lower-right corner of the rectangle.

Applies to

LinearGradientBrush(Rectangle, Color, Color, Single)

Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs

Creates a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and an orientation angle.

public:
 LinearGradientBrush(System::Drawing::Rectangle rect, System::Drawing::Color color1, System::Drawing::Color color2, float angle);
public LinearGradientBrush (System.Drawing.Rectangle rect, System.Drawing.Color color1, System.Drawing.Color color2, float angle);
new System.Drawing.Drawing2D.LinearGradientBrush : System.Drawing.Rectangle * System.Drawing.Color * System.Drawing.Color * single -> System.Drawing.Drawing2D.LinearGradientBrush
Public Sub New (rect As Rectangle, color1 As Color, color2 As Color, angle As Single)

Parameters

rect
Rectangle

A Rectangle structure that specifies the bounds of the linear gradient.

color1
Color

A Color structure that represents the starting color for the gradient.

color2
Color

A Color structure that represents the ending color for the gradient.

angle
Single

The angle, measured in degrees clockwise from the x-axis, of the gradient's orientation line.

Remarks

All points along any line perpendicular to the orientation line are the same color.

The starting line is perpendicular to the orientation line and passes through one of the corners of the rectangle. All points on the starting line are the starting color. Then ending line is perpendicular to the orientation line and passes through one of the corners of the rectangle. All points on the ending line are the ending color.

The angle of the orientation line determines which corners the starting and ending lines pass through. For example, if the angle is between 0 and 90 degrees, the starting line passes through the upper-left corner, and the ending line passes through the lower-right corner.

Applies to

LinearGradientBrush(RectangleF, Color, Color, LinearGradientMode)

Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs

Creates a new instance of the LinearGradientBrush based on a rectangle, starting and ending colors, and an orientation mode.

public:
 LinearGradientBrush(System::Drawing::RectangleF rect, System::Drawing::Color color1, System::Drawing::Color color2, System::Drawing::Drawing2D::LinearGradientMode linearGradientMode);
public LinearGradientBrush (System.Drawing.RectangleF rect, System.Drawing.Color color1, System.Drawing.Color color2, System.Drawing.Drawing2D.LinearGradientMode linearGradientMode);
new System.Drawing.Drawing2D.LinearGradientBrush : System.Drawing.RectangleF * System.Drawing.Color * System.Drawing.Color * System.Drawing.Drawing2D.LinearGradientMode -> System.Drawing.Drawing2D.LinearGradientBrush
Public Sub New (rect As RectangleF, color1 As Color, color2 As Color, linearGradientMode As LinearGradientMode)

Parameters

rect
RectangleF

A RectangleF structure that specifies the bounds of the linear gradient.

color1
Color

A Color structure that represents the starting color for the gradient.

color2
Color

A Color structure that represents the ending color for the gradient.

linearGradientMode
LinearGradientMode

A LinearGradientMode enumeration element that specifies the orientation of the gradient. The orientation determines the starting and ending points of the gradient. For example, LinearGradientMode.ForwardDiagonal specifies that the starting point is the upper-left corner of the rectangle and the ending point is the lower-right corner of the rectangle.

Applies to

LinearGradientBrush(RectangleF, Color, Color, Single)

Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs

Creates a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and an orientation angle.

public:
 LinearGradientBrush(System::Drawing::RectangleF rect, System::Drawing::Color color1, System::Drawing::Color color2, float angle);
public LinearGradientBrush (System.Drawing.RectangleF rect, System.Drawing.Color color1, System.Drawing.Color color2, float angle);
new System.Drawing.Drawing2D.LinearGradientBrush : System.Drawing.RectangleF * System.Drawing.Color * System.Drawing.Color * single -> System.Drawing.Drawing2D.LinearGradientBrush
Public Sub New (rect As RectangleF, color1 As Color, color2 As Color, angle As Single)

Parameters

rect
RectangleF

A RectangleF structure that specifies the bounds of the linear gradient.

color1
Color

A Color structure that represents the starting color for the gradient.

color2
Color

A Color structure that represents the ending color for the gradient.

angle
Single

The angle, measured in degrees clockwise from the x-axis, of the gradient's orientation line.

Remarks

All points along any line perpendicular to the orientation line are the same color.

The starting line is perpendicular to the orientation line and passes through one of the corners of the rectangle. All points on the starting line are the starting color. Then ending line is perpendicular to the orientation line and passes through one of the corners of the rectangle. All points on the ending line are the ending color.

The angle of the orientation line determines which corners the starting and ending lines pass through. For example, if the angle is between 0 and 90 degrees, the starting line passes through the upper-left corner, and the ending line passes through the lower-right corner.

Applies to

LinearGradientBrush(Rectangle, Color, Color, Single, Boolean)

Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs

Creates a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and an orientation angle.

public:
 LinearGradientBrush(System::Drawing::Rectangle rect, System::Drawing::Color color1, System::Drawing::Color color2, float angle, bool isAngleScaleable);
public LinearGradientBrush (System.Drawing.Rectangle rect, System.Drawing.Color color1, System.Drawing.Color color2, float angle, bool isAngleScaleable);
new System.Drawing.Drawing2D.LinearGradientBrush : System.Drawing.Rectangle * System.Drawing.Color * System.Drawing.Color * single * bool -> System.Drawing.Drawing2D.LinearGradientBrush
Public Sub New (rect As Rectangle, color1 As Color, color2 As Color, angle As Single, isAngleScaleable As Boolean)

Parameters

rect
Rectangle

A Rectangle structure that specifies the bounds of the linear gradient.

color1
Color

A Color structure that represents the starting color for the gradient.

color2
Color

A Color structure that represents the ending color for the gradient.

angle
Single

The angle, measured in degrees clockwise from the x-axis, of the gradient's orientation line.

isAngleScaleable
Boolean

Set to true to specify that the angle is affected by the transform associated with this LinearGradientBrush; otherwise, false.

Remarks

All points along any line perpendicular to the orientation line are the same color.

The starting line is perpendicular to the orientation line and passes through one of the corners of the rectangle. All points on the starting line are the starting color. Then ending line is perpendicular to the orientation line and passes through one of the corners of the rectangle. All points on the ending line are the ending color.

The angle of the orientation line determines which corners the starting and ending lines pass through. For example, if the angle is between 0 and 90 degrees, the starting line passes through the upper-left corner, and the ending line passes through the lower-right corner.

Applies to

LinearGradientBrush(RectangleF, Color, Color, Single, Boolean)

Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs

Creates a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and an orientation angle.

public:
 LinearGradientBrush(System::Drawing::RectangleF rect, System::Drawing::Color color1, System::Drawing::Color color2, float angle, bool isAngleScaleable);
public LinearGradientBrush (System.Drawing.RectangleF rect, System.Drawing.Color color1, System.Drawing.Color color2, float angle, bool isAngleScaleable);
new System.Drawing.Drawing2D.LinearGradientBrush : System.Drawing.RectangleF * System.Drawing.Color * System.Drawing.Color * single * bool -> System.Drawing.Drawing2D.LinearGradientBrush
Public Sub New (rect As RectangleF, color1 As Color, color2 As Color, angle As Single, isAngleScaleable As Boolean)

Parameters

rect
RectangleF

A RectangleF structure that specifies the bounds of the linear gradient.

color1
Color

A Color structure that represents the starting color for the gradient.

color2
Color

A Color structure that represents the ending color for the gradient.

angle
Single

The angle, measured in degrees clockwise from the x-axis, of the gradient's orientation line.

isAngleScaleable
Boolean

Set to true to specify that the angle is affected by the transform associated with this LinearGradientBrush; otherwise, false.

Remarks

All points along any line perpendicular to the orientation line are the same color.

The starting line is perpendicular to the orientation line and passes through one of the corners of the rectangle. All points on the starting line are the starting color. Then ending line is perpendicular to the orientation line and passes through one of the corners of the rectangle. All points on the ending line are the ending color.

The angle of the orientation line determines which corners the starting and ending lines pass through. For example, if the angle is between 0 and 90 degrees, the starting line passes through the upper-left corner, and the ending line passes through the lower-right corner.

Applies to