Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

ControlPaint.DrawBorder Method (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.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public static void DrawBorder (
	Graphics graphics,
	Rectangle bounds,
	Color color,
	ButtonBorderStyle style
)
public static void DrawBorder (
	Graphics graphics, 
	Rectangle bounds, 
	Color color, 
	ButtonBorderStyle style
)
public static function DrawBorder (
	graphics : Graphics, 
	bounds : Rectangle, 
	color : Color, 
	style : ButtonBorderStyle
)

Parameters

graphics

The Graphics to draw on.

bounds

The Rectangle that represents the dimensions of the border.

color

The Color of the border.

style

One of the ButtonBorderStyle values that specifies the style of the 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);
}

// 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.get_ClientRectangle();
    borderRectangle.Inflate(-10, -10);
    ControlPaint.DrawBorder3D(e.get_Graphics(), borderRectangle, 
        Border3DStyle.Raised);
} //Form1_Paint

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.