ControlPaint.DrawBorder ControlPaint.DrawBorder ControlPaint.DrawBorder Method

Definition

Draws a border on a button-style control.

Overloads

DrawBorder(Graphics, Rectangle, Color, ButtonBorderStyle) DrawBorder(Graphics, Rectangle, Color, ButtonBorderStyle) DrawBorder(Graphics, Rectangle, Color, ButtonBorderStyle)

Draws a border with the specified style and color, on the specified graphics surface, and within the specified bounds on a button-style control.

DrawBorder(Graphics, Rectangle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle) DrawBorder(Graphics, Rectangle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle) DrawBorder(Graphics, Rectangle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle)

Draws a border on a button-style control with the specified styles, colors, and border widths; on the specified graphics surface; and within the specified bounds.

DrawBorder(Graphics, Rectangle, Color, ButtonBorderStyle) DrawBorder(Graphics, Rectangle, Color, ButtonBorderStyle) DrawBorder(Graphics, Rectangle, Color, ButtonBorderStyle)

Draws a border with the specified style and color, on the specified graphics surface, and within the specified bounds on a button-style control.

public:
 static void DrawBorder(System::Drawing::Graphics ^ graphics, System::Drawing::Rectangle bounds, System::Drawing::Color color, System::Windows::Forms::ButtonBorderStyle style);
public static void DrawBorder (System.Drawing.Graphics graphics, System.Drawing.Rectangle bounds, System.Drawing.Color color, System.Windows.Forms.ButtonBorderStyle style);
static member DrawBorder : System.Drawing.Graphics * System.Drawing.Rectangle * System.Drawing.Color * System.Windows.Forms.ButtonBorderStyle -> unit

Parameters

graphics
Graphics Graphics Graphics

The Graphics to draw on.

bounds
Rectangle Rectangle Rectangle

The Rectangle that represents the dimensions of the border.

color
Color Color Color

The Color of the border.

style
ButtonBorderStyle ButtonBorderStyle ButtonBorderStyle

One of the ButtonBorderStyle values that specifies the style of the border.

Examples

The following code example demonstrates the use of one of the DrawBorder3D methods. To run this example, paste the following code in a form that imports the System.Windows.Forms and System.Drawing namespaces. Ensure the form's Paint event is associated with the event handler in this example.

// Handle the Form's Paint event to draw a 3D three-dimensional 
// raised border just inside the border of the frame.
void Form1_Paint( Object^ /*sender*/, PaintEventArgs^ e )
{
   Rectangle borderRectangle = this->ClientRectangle;
   borderRectangle.Inflate(  -10, -10 );
   ControlPaint::DrawBorder3D( e->Graphics, borderRectangle, Border3DStyle::Raised );
}
// Handle the Form's Paint event to draw a 3D three-dimensional 
// raised border just inside the border of the frame.
private void Form1_Paint(object sender, PaintEventArgs e)
{

	Rectangle borderRectangle = this.ClientRectangle;
	borderRectangle.Inflate(-10, -10);
	ControlPaint.DrawBorder3D(e.Graphics, borderRectangle, 
		Border3DStyle.Raised);
}
' Handle the Form's Paint event to draw a 3D three-dimensional 
' raised border just inside the border of the frame.
Private Sub Form1_Paint(ByVal sender As Object, _
    ByVal e As PaintEventArgs) Handles MyBase.Paint

    Dim borderRectangle As Rectangle = Me.ClientRectangle
    borderRectangle.Inflate(-10, -10)
    ControlPaint.DrawBorder3D(e.Graphics, borderRectangle, _
        Border3DStyle.Raised)
End Sub

DrawBorder(Graphics, Rectangle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle) DrawBorder(Graphics, Rectangle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle) DrawBorder(Graphics, Rectangle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle)

Draws a border on a button-style control with the specified styles, colors, and border widths; on the specified graphics surface; and within the specified bounds.

public:
 static void DrawBorder(System::Drawing::Graphics ^ graphics, System::Drawing::Rectangle bounds, System::Drawing::Color leftColor, int leftWidth, System::Windows::Forms::ButtonBorderStyle leftStyle, System::Drawing::Color topColor, int topWidth, System::Windows::Forms::ButtonBorderStyle topStyle, System::Drawing::Color rightColor, int rightWidth, System::Windows::Forms::ButtonBorderStyle rightStyle, System::Drawing::Color bottomColor, int bottomWidth, System::Windows::Forms::ButtonBorderStyle bottomStyle);
public static void DrawBorder (System.Drawing.Graphics graphics, System.Drawing.Rectangle bounds, System.Drawing.Color leftColor, int leftWidth, System.Windows.Forms.ButtonBorderStyle leftStyle, System.Drawing.Color topColor, int topWidth, System.Windows.Forms.ButtonBorderStyle topStyle, System.Drawing.Color rightColor, int rightWidth, System.Windows.Forms.ButtonBorderStyle rightStyle, System.Drawing.Color bottomColor, int bottomWidth, System.Windows.Forms.ButtonBorderStyle bottomStyle);
static member DrawBorder : System.Drawing.Graphics * System.Drawing.Rectangle * System.Drawing.Color * int * System.Windows.Forms.ButtonBorderStyle * System.Drawing.Color * int * System.Windows.Forms.ButtonBorderStyle * System.Drawing.Color * int * System.Windows.Forms.ButtonBorderStyle * System.Drawing.Color * int * System.Windows.Forms.ButtonBorderStyle -> unit

Parameters

graphics
Graphics Graphics Graphics

The Graphics to draw on.

bounds
Rectangle Rectangle Rectangle

The Rectangle that represents the dimensions of the border.

leftColor
Color Color Color

The Color of the left of the border.

leftWidth
Int32 Int32 Int32

The width of the left border.

leftStyle
ButtonBorderStyle ButtonBorderStyle ButtonBorderStyle

One of the ButtonBorderStyle values that specifies the style of the left border.

topColor
Color Color Color

The Color of the top of the border.

topWidth
Int32 Int32 Int32

The width of the top border.

topStyle
ButtonBorderStyle ButtonBorderStyle ButtonBorderStyle

One of the ButtonBorderStyle values that specifies the style of the top border.

rightColor
Color Color Color

The Color of the right of the border.

rightWidth
Int32 Int32 Int32

The width of the right border.

rightStyle
ButtonBorderStyle ButtonBorderStyle ButtonBorderStyle

One of the ButtonBorderStyle values that specifies the style of the right border.

bottomColor
Color Color Color

The Color of the bottom of the border.

bottomWidth
Int32 Int32 Int32

The width of the bottom border.

bottomStyle
ButtonBorderStyle ButtonBorderStyle ButtonBorderStyle

One of the ButtonBorderStyle values that specifies the style of the bottom border.

Examples

The following code example demonstrates the use of one of the DrawBorder3D methods. To run this example, paste the following code in a form that imports the System.Windows.Forms and System.Drawing namespaces. Ensure the form's Paint event is associated with the event handler in this example.

// Handle the Form's Paint event to draw a 3D three-dimensional 
// raised border just inside the border of the frame.
void Form1_Paint( Object^ /*sender*/, PaintEventArgs^ e )
{
   Rectangle borderRectangle = this->ClientRectangle;
   borderRectangle.Inflate(  -10, -10 );
   ControlPaint::DrawBorder3D( e->Graphics, borderRectangle, Border3DStyle::Raised );
}
// Handle the Form's Paint event to draw a 3D three-dimensional 
// raised border just inside the border of the frame.
private void Form1_Paint(object sender, PaintEventArgs e)
{

	Rectangle borderRectangle = this.ClientRectangle;
	borderRectangle.Inflate(-10, -10);
	ControlPaint.DrawBorder3D(e.Graphics, borderRectangle, 
		Border3DStyle.Raised);
}
' Handle the Form's Paint event to draw a 3D three-dimensional 
' raised border just inside the border of the frame.
Private Sub Form1_Paint(ByVal sender As Object, _
    ByVal e As PaintEventArgs) Handles MyBase.Paint

    Dim borderRectangle As Rectangle = Me.ClientRectangle
    borderRectangle.Inflate(-10, -10)
    ControlPaint.DrawBorder3D(e.Graphics, borderRectangle, _
        Border3DStyle.Raised)
End Sub
See also

Applies to