ControlPaint.DrawBorder 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
在按鈕樣式控制項上繪製框線。
多載
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)
使用指定的樣式和色彩,在指定的圖形表層和按鈕樣式控制項的指定範圍內繪製框線。
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)
參數
- style
- ButtonBorderStyle
其中一個 ButtonBorderStyle 值,指定框線樣式。
範例
下列程式碼範例示範如何使用其中 DrawBorder3D 一種方法。 若要執行此範例,請將下列程式碼貼到匯入 和 System.Drawing 命名空間的表單 System.Windows.Forms 中。 請確定表單的事件 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)
使用指定的樣式、色彩和框線寬度,在指定的圖形介面和指定的範圍內,於按鈕樣式控制項上繪製框線。
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)
參數
- leftWidth
- Int32
左框線的寬度。
- leftStyle
- ButtonBorderStyle
其中一個 ButtonBorderStyle 值,指定左框線的樣式。
- topWidth
- Int32
上框線的寬度。
- topStyle
- ButtonBorderStyle
其中一個 ButtonBorderStyle 值,指定上框線的樣式。
- rightWidth
- Int32
右框線的寬度。
- rightStyle
- ButtonBorderStyle
其中一個 ButtonBorderStyle 值,指定右框線的樣式。
- bottomWidth
- Int32
下框線的寬度。
- bottomStyle
- ButtonBorderStyle
其中一個 ButtonBorderStyle 值,指定底部框線的樣式。
範例
下列程式碼範例示範如何使用其中 DrawBorder3D 一種方法。 若要執行此範例,請將下列程式碼貼到匯入 和 System.Drawing 命名空間的表單 System.Windows.Forms 中。 請確定表單的事件 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