ControlPaint.DrawCaptionButton 方法

定義

畫出一個字幕按鈕控制。

多載

名稱 Description
DrawCaptionButton(Graphics, Rectangle, CaptionButton, ButtonState)

在指定的狀態、圖形表面及範圍內繪製指定的字幕按鈕控制項。

DrawCaptionButton(Graphics, Int32, Int32, Int32, Int32, CaptionButton, ButtonState)

在指定的狀態、圖形表面及範圍內繪製指定的字幕按鈕控制項。

DrawCaptionButton(Graphics, Rectangle, CaptionButton, ButtonState)

來源:
ControlPaint.cs
來源:
ControlPaint.cs
來源:
ControlPaint.cs
來源:
ControlPaint.cs
來源:
ControlPaint.cs

在指定的狀態、圖形表面及範圍內繪製指定的字幕按鈕控制項。

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)

參數

graphics
Graphics

可以 Graphics 參考的。

rectangle
Rectangle

Rectangle 代表標題按鈕的尺寸。

button
CaptionButton

其中一個 CaptionButton 數值會指定要畫哪種說明按鈕。

state
ButtonState

一個位元組合 ButtonState 的值,指定要繪製按鈕的狀態。

範例

以下程式碼範例展示了該 ControlPaint.DrawCaptionButton 方法與 CaptionButton 列舉的使用方法。 要執行此範例,請將以下程式碼貼入包含名為 Button1的按鈕的表單中。 表單應該匯入 System.Windows.FormsSystem.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)

來源:
ControlPaint.cs
來源:
ControlPaint.cs
來源:
ControlPaint.cs
來源:
ControlPaint.cs
來源:
ControlPaint.cs

在指定的狀態、圖形表面及範圍內繪製指定的字幕按鈕控制項。

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)

參數

graphics
Graphics

可以 Graphics 參考的。

x
Int32

圖中矩形左上角的 x 座標。

y
Int32

圖中矩形左上角的 y 座標。

width
Int32

繪圖矩形的寬度。

height
Int32

繪圖矩形的高度。

button
CaptionButton

其中一個 CaptionButton 數值會指定要畫哪種說明按鈕。

state
ButtonState

一個位元組合 ButtonState 的值,指定要繪製按鈕的狀態。

範例

以下程式碼範例展示了該 DrawCaptionButton 方法與 CaptionButton 列舉的使用方法。 要執行此範例,請將以下程式碼貼上包含 Button 一個名為 Button1的表單。 表單應該匯入 System.Windows.FormsSystem.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

另請參閱

適用於