Export (0) Print
Expand All

ControlPaint.DrawBorder Method

Draws a border on a button-style control.

Overload List

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

[Visual Basic] Overloads Public Shared Sub DrawBorder(Graphics, Rectangle, Color, ButtonBorderStyle)
[C#] public static void DrawBorder(Graphics, Rectangle, Color, ButtonBorderStyle);
[C++] public: static void DrawBorder(Graphics*, Rectangle, Color, ButtonBorderStyle);
[JScript] public static function DrawBorder(Graphics, Rectangle, Color, 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.

[Visual Basic] Overloads Public Shared Sub DrawBorder(Graphics, Rectangle, Color, Integer, ButtonBorderStyle, Color, Integer, ButtonBorderStyle, Color, Integer, ButtonBorderStyle, Color, Integer, ButtonBorderStyle)
[C#] public static void DrawBorder(Graphics, Rectangle, Color, int, ButtonBorderStyle, Color, int, ButtonBorderStyle, Color, int, ButtonBorderStyle, Color, int, ButtonBorderStyle);
[C++] public: static void DrawBorder(Graphics*, Rectangle, Color, int, ButtonBorderStyle, Color, int, ButtonBorderStyle, Color, int, ButtonBorderStyle, Color, int, ButtonBorderStyle);
[JScript] public static function DrawBorder(Graphics, Rectangle, Color, int, ButtonBorderStyle, Color, int, ButtonBorderStyle, Color, int, ButtonBorderStyle, Color, int, ButtonBorderStyle);

Example

[Visual Basic, C#] The following code example demonstrates the use of one of the System.Windows.Forms.DrawBorder3D methods. To run this example paste the following code in a form that imports the System.Windows.Forms and System.Drawing namespaces.

[Visual Basic, C#] Note   This example shows how to use one of the overloaded versions of DrawBorder. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
' 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

[C#] 
// 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);
}

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

ControlPaint Class | ControlPaint Members | System.Windows.Forms Namespace

Show:
© 2015 Microsoft