ControlPaint.DrawCaptionButton 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
畫出一個字幕按鈕控制。
多載
| 名稱 | Description |
|---|---|
| DrawCaptionButton(Graphics, Rectangle, CaptionButton, ButtonState) |
在指定的狀態、圖形表面及範圍內繪製指定的字幕按鈕控制項。 |
| DrawCaptionButton(Graphics, Int32, Int32, Int32, Int32, CaptionButton, ButtonState) |
在指定的狀態、圖形表面及範圍內繪製指定的字幕按鈕控制項。 |
DrawCaptionButton(Graphics, Rectangle, CaptionButton, ButtonState)
在指定的狀態、圖形表面及範圍內繪製指定的字幕按鈕控制項。
public:
static void DrawCaptionButton(System::Drawing::Graphics ^ graphics, System::Drawing::Rectangle rectangle, System::Windows::Forms::CaptionButton button, System::Windows::Forms::ButtonState state);
public static void DrawCaptionButton(System.Drawing.Graphics graphics, System.Drawing.Rectangle rectangle, System.Windows.Forms.CaptionButton button, System.Windows.Forms.ButtonState state);
static member DrawCaptionButton : System.Drawing.Graphics * System.Drawing.Rectangle * System.Windows.Forms.CaptionButton * System.Windows.Forms.ButtonState -> unit
Public Shared Sub DrawCaptionButton (graphics As Graphics, rectangle As Rectangle, button As CaptionButton, state As ButtonState)
參數
- button
- CaptionButton
其中一個 CaptionButton 數值會指定要畫哪種說明按鈕。
- state
- ButtonState
一個位元組合 ButtonState 的值,指定要繪製按鈕的狀態。
範例
以下程式碼範例展示了該 ControlPaint.DrawCaptionButton 方法與 CaptionButton 列舉的使用方法。 要執行此範例,請將以下程式碼貼入包含名為 Button1的按鈕的表單中。 表單應該匯入 System.Windows.Forms 和 System.Drawing 命名空間。 在此範例中,請確保按鈕的 Paint 事件與事件處理程序相關聯。
// Handle the Button1 object's Paint Event to create a CaptionButton.
void Button1_Paint( Object^ /*sender*/, PaintEventArgs^ e )
{
// Draw a CaptionButton control using the ClientRectangle
// property of Button1. Make the button a Help button
// with a normal state.
ControlPaint::DrawCaptionButton( e->Graphics, Button1->ClientRectangle, CaptionButton::Help, ButtonState::Normal );
}
// Handle the Button1 object's Paint Event to create a CaptionButton.
private void Button1_Paint(object sender, PaintEventArgs e)
{
// Draw a CaptionButton control using the ClientRectangle
// property of Button1. Make the button a Help button
// with a normal state.
ControlPaint.DrawCaptionButton(e.Graphics, Button1.ClientRectangle,
CaptionButton.Help, ButtonState.Normal);
}
' Handle the Button1 object's Paint Event to create a CaptionButton.
Private Sub Button1_Paint(ByVal sender As Object, _
ByVal e As PaintEventArgs) Handles Button1.Paint
' Draw a CaptionButton control using the ClientRectangle
' property of Button1. Make the button a Help button
' with a normal state.
ControlPaint.DrawCaptionButton(e.Graphics, Button1.ClientRectangle, _
CaptionButton.Help, ButtonState.Normal)
End Sub
另請參閱
適用於
DrawCaptionButton(Graphics, Int32, Int32, Int32, Int32, CaptionButton, ButtonState)
在指定的狀態、圖形表面及範圍內繪製指定的字幕按鈕控制項。
public:
static void DrawCaptionButton(System::Drawing::Graphics ^ graphics, int x, int y, int width, int height, System::Windows::Forms::CaptionButton button, System::Windows::Forms::ButtonState state);
public static void DrawCaptionButton(System.Drawing.Graphics graphics, int x, int y, int width, int height, System.Windows.Forms.CaptionButton button, System.Windows.Forms.ButtonState state);
static member DrawCaptionButton : System.Drawing.Graphics * int * int * int * int * System.Windows.Forms.CaptionButton * System.Windows.Forms.ButtonState -> unit
Public Shared Sub DrawCaptionButton (graphics As Graphics, x As Integer, y As Integer, width As Integer, height As Integer, button As CaptionButton, state As ButtonState)
參數
- x
- Int32
圖中矩形左上角的 x 座標。
- y
- Int32
圖中矩形左上角的 y 座標。
- width
- Int32
繪圖矩形的寬度。
- height
- Int32
繪圖矩形的高度。
- button
- CaptionButton
其中一個 CaptionButton 數值會指定要畫哪種說明按鈕。
- state
- ButtonState
一個位元組合 ButtonState 的值,指定要繪製按鈕的狀態。
範例
以下程式碼範例展示了該 DrawCaptionButton 方法與 CaptionButton 列舉的使用方法。 要執行此範例,請將以下程式碼貼上包含 Button 一個名為 Button1的表單。 表單應該匯入 System.Windows.Forms 和 System.Drawing 命名空間。 在此範例中,請確保按鈕的 Paint 事件與事件處理程序相關聯。
// Handle the Button1 object's Paint Event to create a CaptionButton.
void Button1_Paint( Object^ /*sender*/, PaintEventArgs^ e )
{
// Draw a CaptionButton control using the ClientRectangle
// property of Button1. Make the button a Help button
// with a normal state.
ControlPaint::DrawCaptionButton( e->Graphics, Button1->ClientRectangle, CaptionButton::Help, ButtonState::Normal );
}
// Handle the Button1 object's Paint Event to create a CaptionButton.
private void Button1_Paint(object sender, PaintEventArgs e)
{
// Draw a CaptionButton control using the ClientRectangle
// property of Button1. Make the button a Help button
// with a normal state.
ControlPaint.DrawCaptionButton(e.Graphics, Button1.ClientRectangle,
CaptionButton.Help, ButtonState.Normal);
}
' Handle the Button1 object's Paint Event to create a CaptionButton.
Private Sub Button1_Paint(ByVal sender As Object, _
ByVal e As PaintEventArgs) Handles Button1.Paint
' Draw a CaptionButton control using the ClientRectangle
' property of Button1. Make the button a Help button
' with a normal state.
ControlPaint.DrawCaptionButton(e.Graphics, Button1.ClientRectangle, _
CaptionButton.Help, ButtonState.Normal)
End Sub