ControlPaint.DrawCaptionButton Methode

Definition

Zeichnet ein Titelleisten-Schaltflächen-Steuerelement.

Überlädt

DrawCaptionButton(Graphics, Rectangle, CaptionButton, ButtonState)

Zeichnet auf der angegebenen Grafikoberfläche und innerhalb der angegebenen Begrenzungen das angegebene Titelleisten-Schaltflächen-Steuerelement im angegebenen Zustand.

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

Zeichnet auf der angegebenen Grafikoberfläche und innerhalb der angegebenen Begrenzungen das angegebene Titelleisten-Schaltflächen-Steuerelement im angegebenen Zustand.

DrawCaptionButton(Graphics, Rectangle, CaptionButton, ButtonState)

Zeichnet auf der angegebenen Grafikoberfläche und innerhalb der angegebenen Begrenzungen das angegebene Titelleisten-Schaltflächen-Steuerelement im angegebenen Zustand.

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)

Parameter

graphics
Graphics

Die Instanz von Graphics, in der gezeichnet werden soll.

rectangle
Rectangle

Das Rectangle, das die Abmessungen der Titelleisten-Schaltfläche darstellt.

button
CaptionButton

Einer der CaptionButton-Werte, der den Typ der zu zeichnenden Titelleisten-Schaltfläche angibt.

state
ButtonState

Eine bitweise Kombination der ButtonState-Werte, die den Zustand für das Zeichnen der Schaltfläche angibt.

Beispiele

Im folgenden Codebeispiel wird die Verwendung der ControlPaint.DrawCaptionButton Methode und der CaptionButton Enumeration veranschaulicht. Fügen Sie zum Ausführen dieses Beispiels den folgenden Code in ein Formular ein, das eine Schaltfläche mit dem Namen enthält Button1. Das Formular sollte die System.Windows.Forms Namespaces und System.Drawing importieren. Stellen Sie sicher, Paint dass das Ereignis der Schaltfläche dem Ereignishandler in diesem Beispiel zugeordnet ist.

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

Weitere Informationen

Gilt für:

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

Zeichnet auf der angegebenen Grafikoberfläche und innerhalb der angegebenen Begrenzungen das angegebene Titelleisten-Schaltflächen-Steuerelement im angegebenen Zustand.

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)

Parameter

graphics
Graphics

Die Instanz von Graphics, in der gezeichnet werden soll.

x
Int32

Die x-Koordinate der oberen linken Seite des Zeichenrechtecks.

y
Int32

Die y-Koordinate der oberen linken Seite des Zeichenrechtecks.

width
Int32

Die Breite des Zeichenrechtecks.

height
Int32

Die Höhe des Zeichenrechtecks.

button
CaptionButton

Einer der CaptionButton-Werte, der den Typ der zu zeichnenden Titelleisten-Schaltfläche angibt.

state
ButtonState

Eine bitweise Kombination der ButtonState-Werte, die den Zustand für das Zeichnen der Schaltfläche angibt.

Beispiele

Im folgenden Codebeispiel wird die Verwendung der DrawCaptionButton Methode und der CaptionButton Enumeration veranschaulicht. Fügen Sie zum Ausführen dieses Beispiels den folgenden Code in ein Formular ein, das einen Button namen Button1enthält. Das Formular sollte die System.Windows.Forms Namespaces und System.Drawing importieren. Stellen Sie sicher, Paint dass das Ereignis der Schaltfläche dem Ereignishandler in diesem Beispiel zugeordnet ist.

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

Weitere Informationen

Gilt für: