ControlPaint.DrawCaptionButton Méthode

Définition

Dessine un contrôle bouton de barre de titre.

Surcharges

DrawCaptionButton(Graphics, Rectangle, CaptionButton, ButtonState)

Dessine le contrôle bouton de barre de titre spécifié dans l'état spécifié, sur la surface graphique spécifiée et dans les limites spécifiées.

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

Dessine le contrôle bouton de barre de titre spécifié dans l'état spécifié, sur la surface graphique spécifiée et dans les limites spécifiées.

DrawCaptionButton(Graphics, Rectangle, CaptionButton, ButtonState)

Dessine le contrôle bouton de barre de titre spécifié dans l'état spécifié, sur la surface graphique spécifiée et dans les limites spécifiées.

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)

Paramètres

graphics
Graphics

Graphics sur lequel dessiner.

rectangle
Rectangle

Rectangle représentant les dimensions du bouton de barre de titre.

button
CaptionButton

Une des valeurs de CaptionButton qui spécifie le type de bouton de barre de titre à dessiner.

state
ButtonState

Combinaison d'opérations de bits des valeurs de ButtonState qui spécifie l'état dans lequel le bouton doit être dessiné.

Exemples

L’exemple de code suivant illustre l’utilisation de la ControlPaint.DrawCaptionButton méthode et de l’énumération CaptionButton . Pour exécuter cet exemple, collez le code suivant dans un formulaire contenant un bouton nommé Button1. Le formulaire doit importer les espaces de System.Windows.Forms noms et .System.Drawing Vérifiez que l’événement du Paint bouton est associé au gestionnaire d’événements dans cet exemple.

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

Voir aussi

S’applique à

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

Dessine le contrôle bouton de barre de titre spécifié dans l'état spécifié, sur la surface graphique spécifiée et dans les limites spécifiées.

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)

Paramètres

graphics
Graphics

Graphics sur lequel dessiner.

x
Int32

Coordonnée x du coin supérieur gauche du rectangle de dessin.

y
Int32

Coordonnée y du coin supérieur gauche du rectangle de dessin.

width
Int32

Largeur du rectangle de dessin.

height
Int32

Hauteur du rectangle de dessin.

button
CaptionButton

Une des valeurs de CaptionButton qui spécifie le type de bouton de barre de titre à dessiner.

state
ButtonState

Combinaison d'opérations de bits des valeurs de ButtonState qui spécifie l'état dans lequel le bouton doit être dessiné.

Exemples

L’exemple de code suivant illustre l’utilisation de la DrawCaptionButton méthode et de l’énumération CaptionButton . Pour exécuter cet exemple, collez le code suivant dans un formulaire contenant un Button nommé Button1. Le formulaire doit importer les espaces de System.Windows.Forms noms et .System.Drawing Vérifiez que l’événement du Paint bouton est associé au gestionnaire d’événements dans cet exemple.

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

Voir aussi

S’applique à