ControlPaint.DrawCaptionButton Metodo

Definizione

Disegna un controllo pulsante della barra del titolo.

Overload

DrawCaptionButton(Graphics, Rectangle, CaptionButton, ButtonState)

Disegna il controllo pulsante della barra del titolo specificato nello stato determinato sulla superficie grafica specificata e all'interno dei limiti definiti.

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

Disegna il controllo pulsante della barra del titolo specificato nello stato determinato sulla superficie grafica specificata e all'interno dei limiti definiti.

DrawCaptionButton(Graphics, Rectangle, CaptionButton, ButtonState)

Disegna il controllo pulsante della barra del titolo specificato nello stato determinato sulla superficie grafica specificata e all'interno dei limiti definiti.

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)

Parametri

graphics
Graphics

Oggetto Graphics su cui disegnare.

rectangle
Rectangle

Oggetto Rectangle che rappresenta le dimensioni del pulsante della barra del titolo.

button
CaptionButton

Uno dei valori di CaptionButton che specifica il tipo di pulsante della barra del titolo da disegnare.

state
ButtonState

Combinazione bit per bit dei valori di ButtonState che specifica lo stato in cui disegnare il pulsante.

Esempio

Nell'esempio di codice seguente viene illustrato l'uso del ControlPaint.DrawCaptionButton metodo e dell'enumerazione CaptionButton . Per eseguire questo esempio, incollare il codice seguente in un modulo contenente un pulsante denominato Button1. Il modulo deve importare gli System.Windows.Forms spazi dei nomi e System.Drawing . Verificare che l'evento del Paint pulsante sia associato al gestore eventi in questo esempio.

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

Vedi anche

Si applica a

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

Disegna il controllo pulsante della barra del titolo specificato nello stato determinato sulla superficie grafica specificata e all'interno dei limiti definiti.

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)

Parametri

graphics
Graphics

Oggetto Graphics su cui disegnare.

x
Int32

Coordinata x della parte superiore sinistra del rettangolo di disegno.

y
Int32

Coordinata y della parte superiore sinistra del rettangolo di disegno.

width
Int32

Larghezza del rettangolo di disegno.

height
Int32

Altezza del rettangolo di disegno.

button
CaptionButton

Uno dei valori di CaptionButton che specifica il tipo di pulsante della barra del titolo da disegnare.

state
ButtonState

Combinazione bit per bit dei valori di ButtonState che specifica lo stato in cui disegnare il pulsante.

Esempio

Nell'esempio di codice seguente viene illustrato l'uso del DrawCaptionButton metodo e dell'enumerazione CaptionButton . Per eseguire questo esempio, incollare il codice seguente in un modulo contenente un Button oggetto denominato Button1. Il modulo deve importare gli System.Windows.Forms spazi dei nomi e System.Drawing . Verificare che l'evento del Paint pulsante sia associato al gestore eventi in questo esempio.

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

Vedi anche

Si applica a