ControlPaint.DrawBorder Método

Definição

Desenha uma borda num controlo ao estilo de botão.

Sobrecargas

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

Desenha uma borda com o estilo e cor especificados, na superfície gráfica especificada e dentro dos limites especificados num controlo ao estilo de botão.

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

Desenha uma borda num controlo ao estilo de botão com os estilos, cores e larguras de borda especificados; na superfície gráfica especificada; e dentro dos limites especificados.

DrawBorder(Graphics, Rectangle, Color, ButtonBorderStyle)

Origem:
ControlPaint.cs
Origem:
ControlPaint.cs
Origem:
ControlPaint.cs
Origem:
ControlPaint.cs
Origem:
ControlPaint.cs

Desenha uma borda com o estilo e cor especificados, na superfície gráfica especificada e dentro dos limites especificados num controlo ao estilo de botão.

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)

Parâmetros

graphics
Graphics

O Graphics para recorrer.

bounds
Rectangle

O Rectangle que representa as dimensões da fronteira.

color
Color

A Color da fronteira.

style
ButtonBorderStyle

Um dos ButtonBorderStyle valores que especifica o estilo da borda.

Exemplos

O seguinte exemplo de código demonstra a utilização de um dos DrawBorder3D métodos. Para executar este exemplo, cole o código seguinte numa forma que importe os namespaces System.Windows.Forms e System.Drawing. Certifique-se de que o evento do Paint formulário está associado ao gestor de eventos neste exemplo.

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

Aplica-se a

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

Origem:
ControlPaint.cs
Origem:
ControlPaint.cs
Origem:
ControlPaint.cs
Origem:
ControlPaint.cs
Origem:
ControlPaint.cs

Desenha uma borda num controlo ao estilo de botão com os estilos, cores e larguras de borda especificados; na superfície gráfica especificada; e dentro dos limites especificados.

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)

Parâmetros

graphics
Graphics

O Graphics para recorrer.

bounds
Rectangle

O Rectangle que representa as dimensões da fronteira.

leftColor
Color

O Color da esquerda da fronteira.

leftWidth
Int32

A largura da borda esquerda.

leftStyle
ButtonBorderStyle

Um dos ButtonBorderStyle valores que especifica o estilo da borda esquerda.

topColor
Color

O Color do topo da fronteira.

topWidth
Int32

A largura da borda superior.

topStyle
ButtonBorderStyle

Um dos ButtonBorderStyle valores que especifica o estilo da borda superior.

rightColor
Color

A Color direita da fronteira.

rightWidth
Int32

A largura da borda direita.

rightStyle
ButtonBorderStyle

Um dos ButtonBorderStyle valores que especifica o estilo da borda direita.

bottomColor
Color

O Color do fundo da fronteira.

bottomWidth
Int32

A largura da borda inferior.

bottomStyle
ButtonBorderStyle

Um dos ButtonBorderStyle valores que especifica o estilo da borda inferior.

Exemplos

O seguinte exemplo de código demonstra a utilização de um dos DrawBorder3D métodos. Para executar este exemplo, cole o código seguinte numa forma que importe os namespaces System.Windows.Forms e System.Drawing. Certifique-se de que o evento do Paint formulário está associado ao gestor de eventos neste exemplo.

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

Ver também

Aplica-se a