Язык

ControlPaint.DrawBorder Метод

Определение

Рисует границу в элементе управления "Стиль кнопки".

Перегрузки

Имя Описание
DrawBorder(Graphics, Rectangle, Color, ButtonBorderStyle)

Рисует границу с указанным стилем и цветом на указанной графической поверхности и в пределах указанных границ в элементе управления стилей кнопки.

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

Рисует границу в элементе управления "Стиль кнопки" с указанными стилями, цветами и ширинами границ; на указанной графической поверхности; и в пределах указанных границ.

DrawBorder(Graphics, Rectangle, Color, ButtonBorderStyle)

Исходный код:
ControlPaint.cs
Исходный код:
ControlPaint.cs
Исходный код:
ControlPaint.cs
Исходный код:
ControlPaint.cs
Исходный код:
ControlPaint.cs

Рисует границу с указанным стилем и цветом на указанной графической поверхности и в пределах указанных границ в элементе управления стилей кнопки.

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
Public Shared Sub DrawBorder (graphics As Graphics, bounds As Rectangle, color As Color, style As ButtonBorderStyle)

Параметры

graphics
Graphics

Нарисуйте Graphics .

bounds
Rectangle

Значение Rectangle , представляющее размеры границы.

color
Color

Граница Color .

style
ButtonBorderStyle

Одно из ButtonBorderStyle значений, указывающее стиль границы.

Примеры

В следующем примере кода показано использование одного из DrawBorder3D методов. Чтобы запустить этот пример, вставьте следующий код в форму, которая импортирует пространства имен System.Windows.Forms и System.Drawing. Убедитесь, что событие формы Paint связано с обработчиком событий в этом примере.

// 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)

Исходный код:
ControlPaint.cs
Исходный код:
ControlPaint.cs
Исходный код:
ControlPaint.cs
Исходный код:
ControlPaint.cs
Исходный код:
ControlPaint.cs

Рисует границу в элементе управления "Стиль кнопки" с указанными стилями, цветами и ширинами границ; на указанной графической поверхности; и в пределах указанных границ.

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
Public Shared Sub DrawBorder (graphics As Graphics, bounds As Rectangle, leftColor As Color, leftWidth As Integer, leftStyle As ButtonBorderStyle, topColor As Color, topWidth As Integer, topStyle As ButtonBorderStyle, rightColor As Color, rightWidth As Integer, rightStyle As ButtonBorderStyle, bottomColor As Color, bottomWidth As Integer, bottomStyle As ButtonBorderStyle)

Параметры

graphics
Graphics

Нарисуйте Graphics .

bounds
Rectangle

Значение Rectangle , представляющее размеры границы.

leftColor
Color

Color Слева от границы.

leftWidth
Int32

Ширина левой границы.

leftStyle
ButtonBorderStyle

Одно из ButtonBorderStyle значений, указывающее стиль левой границы.

topColor
Color

Верхняя Color часть границы.

topWidth
Int32

Ширина верхней границы.

topStyle
ButtonBorderStyle

Одно из ButtonBorderStyle значений, указывающее стиль верхней границы.

rightColor
Color

Color Справа от границы.

rightWidth
Int32

Ширина правой границы.

rightStyle
ButtonBorderStyle

Одно из ButtonBorderStyle значений, указывающее стиль правой границы.

bottomColor
Color

Нижняя Color часть границы.

bottomWidth
Int32

Ширина нижней границы.

bottomStyle
ButtonBorderStyle

Одно из ButtonBorderStyle значений, указывающее стиль нижней границы.

Примеры

В следующем примере кода показано использование одного из DrawBorder3D методов. Чтобы запустить этот пример, вставьте следующий код в форму, которая импортирует пространства имен System.Windows.Forms и System.Drawing. Убедитесь, что событие формы Paint связано с обработчиком событий в этом примере.

// 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

См. также раздел

Применяется к