Bagikan melalui


ControlPaint.DrawBorder Metode

Definisi

Menggambar batas pada kontrol gaya tombol.

Overload

DrawBorder(Graphics, Rectangle, Color, ButtonBorderStyle)

Menggambar batas dengan gaya dan warna yang ditentukan, pada permukaan grafik yang ditentukan, dan di dalam batas yang ditentukan pada kontrol gaya tombol.

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

Menggambar batas pada kontrol gaya tombol dengan gaya, warna, dan lebar batas yang ditentukan; pada permukaan grafis yang ditentukan; dan dalam batas yang ditentukan.

DrawBorder(Graphics, Rectangle, Color, ButtonBorderStyle)

Menggambar batas dengan gaya dan warna yang ditentukan, pada permukaan grafik yang ditentukan, dan di dalam batas yang ditentukan pada kontrol gaya tombol.

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)

Parameter

graphics
Graphics

Untuk Graphics menggambar.

bounds
Rectangle

Rectangle yang mewakili dimensi batas.

color
Color

Perbatasan Color .

style
ButtonBorderStyle

Salah ButtonBorderStyle satu nilai yang menentukan gaya batas.

Contoh

Contoh kode berikut menunjukkan penggunaan salah DrawBorder3D satu metode. Untuk menjalankan contoh ini, tempelkan kode berikut dalam formulir yang mengimpor System.Windows.Forms namespace dan System.Drawing . Pastikan peristiwa formulir Paint dikaitkan dengan penanganan aktivitas dalam contoh ini.

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

Berlaku untuk

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

Menggambar batas pada kontrol gaya tombol dengan gaya, warna, dan lebar batas yang ditentukan; pada permukaan grafis yang ditentukan; dan dalam batas yang ditentukan.

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)

Parameter

graphics
Graphics

Untuk Graphics menggambar.

bounds
Rectangle

Rectangle yang mewakili dimensi batas.

leftColor
Color

Sebelah Color kiri perbatasan.

leftWidth
Int32

Lebar batas kiri.

leftStyle
ButtonBorderStyle

Salah ButtonBorderStyle satu nilai yang menentukan gaya batas kiri.

topColor
Color

Bagian Color atas perbatasan.

topWidth
Int32

Lebar batas atas.

topStyle
ButtonBorderStyle

Salah ButtonBorderStyle satu nilai yang menentukan gaya batas atas.

rightColor
Color

Sebelah Color kanan perbatasan.

rightWidth
Int32

Lebar batas kanan.

rightStyle
ButtonBorderStyle

Salah ButtonBorderStyle satu nilai yang menentukan gaya batas kanan.

bottomColor
Color

Bagian Color bawah perbatasan.

bottomWidth
Int32

Lebar batas bawah.

bottomStyle
ButtonBorderStyle

Salah ButtonBorderStyle satu nilai yang menentukan gaya batas bawah.

Contoh

Contoh kode berikut menunjukkan penggunaan salah DrawBorder3D satu metode. Untuk menjalankan contoh ini, tempelkan kode berikut dalam formulir yang mengimpor System.Windows.Forms namespace dan System.Drawing . Pastikan peristiwa formulir Paint dikaitkan dengan penanganan aktivitas dalam contoh ini.

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

Lihat juga

Berlaku untuk