ControlPaint.DrawBorder Method (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.
Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
public static void DrawBorder( Graphics graphics, Rectangle bounds, Color leftColor, int leftWidth, ButtonBorderStyle leftStyle, Color topColor, int topWidth, ButtonBorderStyle topStyle, Color rightColor, int rightWidth, ButtonBorderStyle rightStyle, Color bottomColor, int bottomWidth, ButtonBorderStyle bottomStyle )
Parameters
- graphics
- Type: System.Drawing.Graphics
The Graphics to draw on.
- bounds
- Type: System.Drawing.Rectangle
The Rectangle that represents the dimensions of the border.
- leftColor
- Type: System.Drawing.Color
The Color of the left of the border.
- leftWidth
- Type: System.Int32
The width of the left border.
- leftStyle
- Type: System.Windows.Forms.ButtonBorderStyle
One of the ButtonBorderStyle values that specifies the style of the left border.
- topColor
- Type: System.Drawing.Color
The Color of the top of the border.
- topWidth
- Type: System.Int32
The width of the top border.
- topStyle
- Type: System.Windows.Forms.ButtonBorderStyle
One of the ButtonBorderStyle values that specifies the style of the top border.
- rightColor
- Type: System.Drawing.Color
The Color of the right of the border.
- rightWidth
- Type: System.Int32
The width of the right border.
- rightStyle
- Type: System.Windows.Forms.ButtonBorderStyle
One of the ButtonBorderStyle values that specifies the style of the right border.
- bottomColor
- Type: System.Drawing.Color
The Color of the bottom of the border.
- bottomWidth
- Type: System.Int32
The width of the bottom border.
- bottomStyle
- Type: System.Windows.Forms.ButtonBorderStyle
One of the ButtonBorderStyle values that specifies the style of the bottom border.
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. private void Form1_Paint(object sender, PaintEventArgs e) { Rectangle borderRectangle = this.ClientRectangle; borderRectangle.Inflate(-10, -10); ControlPaint.DrawBorder3D(e.Graphics, borderRectangle, Border3DStyle.Raised); }
method. To run this example paste the following code in a form that imports the
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.