ControlPaint.DrawCaptionButton Metod

Definition

Ritar en knappkontroll för bildtext.

Överlagringar

Name Description
DrawCaptionButton(Graphics, Rectangle, CaptionButton, ButtonState)

Ritar den angivna knappkontrollen i det angivna tillståndet, på den angivna grafikytan och inom de angivna gränserna.

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

Ritar den angivna knappkontrollen i det angivna tillståndet, på den angivna grafikytan och inom de angivna gränserna.

DrawCaptionButton(Graphics, Rectangle, CaptionButton, ButtonState)

Källa:
ControlPaint.cs
Källa:
ControlPaint.cs
Källa:
ControlPaint.cs
Källa:
ControlPaint.cs
Källa:
ControlPaint.cs

Ritar den angivna knappkontrollen i det angivna tillståndet, på den angivna grafikytan och inom de angivna gränserna.

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)

Parametrar

graphics
Graphics

Att Graphics dra på.

rectangle
Rectangle

Det Rectangle som representerar måtten för bildtextknappen.

button
CaptionButton

Ett av de CaptionButton värden som anger vilken typ av beskrivningsknapp som ska ritas.

state
ButtonState

En bitvis kombination av de ButtonState värden som anger tillståndet för att dra in knappen.

Exempel

I följande kodexempel visas hur metoden och ControlPaint.DrawCaptionButton uppräkningen användsCaptionButton. Om du vill köra det här exemplet klistrar du in följande kod i ett formulär som innehåller en knapp med namnet Button1. Formuläret ska importera namnrymderna System.Windows.Forms och System.Drawing. Kontrollera att knappens Paint händelse är associerad med händelsehanteraren i det här exemplet.

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

Se även

Gäller för

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

Källa:
ControlPaint.cs
Källa:
ControlPaint.cs
Källa:
ControlPaint.cs
Källa:
ControlPaint.cs
Källa:
ControlPaint.cs

Ritar den angivna knappkontrollen i det angivna tillståndet, på den angivna grafikytan och inom de angivna gränserna.

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)

Parametrar

graphics
Graphics

Att Graphics dra på.

x
Int32

X-koordinaten överst till vänster i ritningsrektangeln.

y
Int32

Y-koordinaten överst till vänster i ritningsrektangeln.

width
Int32

Bredden på ritningsrektangeln.

height
Int32

Ritningsrektangelns höjd.

button
CaptionButton

Ett av de CaptionButton värden som anger vilken typ av beskrivningsknapp som ska ritas.

state
ButtonState

En bitvis kombination av de ButtonState värden som anger tillståndet för att dra in knappen.

Exempel

I följande kodexempel visas hur metoden och DrawCaptionButton uppräkningen användsCaptionButton. Om du vill köra det här exemplet klistrar du in följande kod i ett formulär som innehåller namnet ButtonButton1. Formuläret ska importera namnrymderna System.Windows.Forms och System.Drawing. Kontrollera att knappens Paint händelse är associerad med händelsehanteraren i det här exemplet.

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

Se även

Gäller för