CheckBoxRenderer.DrawCheckBox Methode

Definitie

Hiermee tekent u een besturingselement voor selectievakjes.

Overloads

Name Description
DrawCheckBox(Graphics, Point, CheckBoxState)

Hiermee tekent u een selectievakje in de opgegeven status en locatie.

DrawCheckBox(Graphics, Point, Rectangle, String, Font, Boolean, CheckBoxState)

Hiermee tekent u een selectievakje in de opgegeven status en locatie, met de opgegeven tekst en met een optionele focusrechthoek.

DrawCheckBox(Graphics, Point, Rectangle, String, Font, TextFormatFlags, Boolean, CheckBoxState)

Hiermee tekent u een selectievakje in de opgegeven status en locatie, met de opgegeven tekst- en tekstopmaak en met een optionele focusrechthoek.

DrawCheckBox(Graphics, Point, Rectangle, String, Font, Image, Rectangle, Boolean, CheckBoxState)

Hiermee tekent u een selectievakje in de opgegeven status en locatie, met de opgegeven tekst en afbeelding en met een optionele focusrechthoek.

DrawCheckBox(Graphics, Point, Rectangle, String, Font, TextFormatFlags, Image, Rectangle, Boolean, CheckBoxState)

Hiermee tekent u een selectievakje in de opgegeven status en locatie; met de opgegeven tekst, tekstopmaak en afbeelding; en met een optionele focusrechthoek.

DrawCheckBox(Graphics, Point, CheckBoxState)

Bron:
CheckBoxRenderer.cs
Bron:
CheckBoxRenderer.cs
Bron:
CheckBoxRenderer.cs
Bron:
CheckBoxRenderer.cs
Bron:
CheckBoxRenderer.cs

Hiermee tekent u een selectievakje in de opgegeven status en locatie.

public:
 static void DrawCheckBox(System::Drawing::Graphics ^ g, System::Drawing::Point glyphLocation, System::Windows::Forms::VisualStyles::CheckBoxState state);
public static void DrawCheckBox(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Windows.Forms.VisualStyles.CheckBoxState state);
static member DrawCheckBox : System.Drawing.Graphics * System.Drawing.Point * System.Windows.Forms.VisualStyles.CheckBoxState -> unit
Public Shared Sub DrawCheckBox (g As Graphics, glyphLocation As Point, state As CheckBoxState)

Parameters

g
Graphics

Het Graphics selectievakje waarmee u het selectievakje tekent.

glyphLocation
Point

Het Point selectievakje waar u het selectievakje wilt tekenen.

state
CheckBoxState

Een van de CheckBoxState waarden waarmee de visuele status van het selectievakje wordt opgegeven.

Opmerkingen

Als visuele stijlen zijn ingeschakeld in het besturingssysteem en visuele stijlen worden toegepast op de huidige toepassing, wordt met deze methode het selectievakje getekend met de huidige visuele stijl. Anders wordt het selectievakje getekend met de klassieke stijl Windows.

Van toepassing op

DrawCheckBox(Graphics, Point, Rectangle, String, Font, Boolean, CheckBoxState)

Bron:
CheckBoxRenderer.cs
Bron:
CheckBoxRenderer.cs
Bron:
CheckBoxRenderer.cs
Bron:
CheckBoxRenderer.cs
Bron:
CheckBoxRenderer.cs

Hiermee tekent u een selectievakje in de opgegeven status en locatie, met de opgegeven tekst en met een optionele focusrechthoek.

public:
 static void DrawCheckBox(System::Drawing::Graphics ^ g, System::Drawing::Point glyphLocation, System::Drawing::Rectangle textBounds, System::String ^ checkBoxText, System::Drawing::Font ^ font, bool focused, System::Windows::Forms::VisualStyles::CheckBoxState state);
public static void DrawCheckBox(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string checkBoxText, System.Drawing.Font font, bool focused, System.Windows.Forms.VisualStyles.CheckBoxState state);
public static void DrawCheckBox(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string? checkBoxText, System.Drawing.Font? font, bool focused, System.Windows.Forms.VisualStyles.CheckBoxState state);
static member DrawCheckBox : System.Drawing.Graphics * System.Drawing.Point * System.Drawing.Rectangle * string * System.Drawing.Font * bool * System.Windows.Forms.VisualStyles.CheckBoxState -> unit
Public Shared Sub DrawCheckBox (g As Graphics, glyphLocation As Point, textBounds As Rectangle, checkBoxText As String, font As Font, focused As Boolean, state As CheckBoxState)

Parameters

g
Graphics

Het Graphics selectievakje waarmee u het selectievakje tekent.

glyphLocation
Point

Het Point selectievakje waar u het selectievakje wilt tekenen.

textBounds
Rectangle

De Rectangle te tekenen checkBoxText .

checkBoxText
String

Het String selectievakje om met het selectievakje te tekenen.

font
Font

De Font toe te checkBoxTextpassen op .

focused
Boolean

true om een focusrechthoek te tekenen; anders, false.

state
CheckBoxState

Een van de CheckBoxState waarden waarmee de visuele status van het selectievakje wordt opgegeven.

Opmerkingen

Als visuele stijlen zijn ingeschakeld in het besturingssysteem en visuele stijlen worden toegepast op de huidige toepassing, wordt met deze methode het selectievakje getekend met de huidige visuele stijl. Anders wordt het selectievakje getekend met de klassieke stijl Windows.

Van toepassing op

DrawCheckBox(Graphics, Point, Rectangle, String, Font, TextFormatFlags, Boolean, CheckBoxState)

Bron:
CheckBoxRenderer.cs
Bron:
CheckBoxRenderer.cs
Bron:
CheckBoxRenderer.cs
Bron:
CheckBoxRenderer.cs
Bron:
CheckBoxRenderer.cs

Hiermee tekent u een selectievakje in de opgegeven status en locatie, met de opgegeven tekst- en tekstopmaak en met een optionele focusrechthoek.

public:
 static void DrawCheckBox(System::Drawing::Graphics ^ g, System::Drawing::Point glyphLocation, System::Drawing::Rectangle textBounds, System::String ^ checkBoxText, System::Drawing::Font ^ font, System::Windows::Forms::TextFormatFlags flags, bool focused, System::Windows::Forms::VisualStyles::CheckBoxState state);
public static void DrawCheckBox(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string checkBoxText, System.Drawing.Font font, System.Windows.Forms.TextFormatFlags flags, bool focused, System.Windows.Forms.VisualStyles.CheckBoxState state);
public static void DrawCheckBox(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string? checkBoxText, System.Drawing.Font? font, System.Windows.Forms.TextFormatFlags flags, bool focused, System.Windows.Forms.VisualStyles.CheckBoxState state);
static member DrawCheckBox : System.Drawing.Graphics * System.Drawing.Point * System.Drawing.Rectangle * string * System.Drawing.Font * System.Windows.Forms.TextFormatFlags * bool * System.Windows.Forms.VisualStyles.CheckBoxState -> unit
Public Shared Sub DrawCheckBox (g As Graphics, glyphLocation As Point, textBounds As Rectangle, checkBoxText As String, font As Font, flags As TextFormatFlags, focused As Boolean, state As CheckBoxState)

Parameters

g
Graphics

Het Graphics selectievakje waarmee u het selectievakje tekent.

glyphLocation
Point

Het Point selectievakje waar u het selectievakje wilt tekenen.

textBounds
Rectangle

De Rectangle te tekenen checkBoxText .

checkBoxText
String

Het String selectievakje om met het selectievakje te tekenen.

font
Font

De Font toe te checkBoxTextpassen op .

flags
TextFormatFlags

Een bitsgewijze combinatie van de TextFormatFlags waarden.

focused
Boolean

true om een focusrechthoek te tekenen; anders, false.

state
CheckBoxState

Een van de CheckBoxState waarden waarmee de visuele status van het selectievakje wordt opgegeven.

Voorbeelden

In het volgende codevoorbeeld wordt de methode in de DrawCheckBox(Graphics, Point, Rectangle, String, Font, TextFormatFlags, Boolean, CheckBoxState) methode van OnPaint een aangepast besturingselement gebruikt om een selectievakje te tekenen in de status die wordt bepaald door de locatie van de muis aanwijzer. Dit codevoorbeeld maakt deel uit van een groter voorbeeld voor de CheckBoxRenderer klasse.

// Draw the check box in the current state.
virtual void OnPaint(PaintEventArgs ^e) override
{
    Control::OnPaint(e);

    CheckBoxRenderer::DrawCheckBox(e->Graphics,
        ClientRectangle.Location, this->getTextRectangle(), this->Text,
        this->Font, TextFormatFlags::HorizontalCenter,
        clicked, state);
}


// Draw the check box in the checked or unchecked state, alternately.
virtual void OnMouseDown(MouseEventArgs ^e) override
{
    Control::OnMouseDown(e);

    if (!clicked)
    {
        clicked = true;
        this->Text = "Clicked!";
        state = CheckBoxState::CheckedPressed;
        Invalidate();
    }
    else
    {
        clicked = false;
        this->Text = "Click here";
        state = CheckBoxState::UncheckedNormal;
        Invalidate();
    }
}
// Draw the check box in the current state.
protected override void OnPaint(PaintEventArgs e)
{
    base.OnPaint(e);

    CheckBoxRenderer.DrawCheckBox(e.Graphics,
        ClientRectangle.Location, TextRectangle, this.Text,
        this.Font, TextFormatFlags.HorizontalCenter,
        clicked, state);
}

// Draw the check box in the checked or unchecked state, alternately.
protected override void OnMouseDown(MouseEventArgs e)
{
    base.OnMouseDown(e);

    if (!clicked)
    {
        clicked = true;
        this.Text = "Clicked!";
        state = CheckBoxState.CheckedPressed;
        Invalidate();
    }
    else
    {
        clicked = false;
        this.Text = "Click here";
        state = CheckBoxState.UncheckedNormal;
        Invalidate();
    }
}
' Draw the check box in the current state.
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
    MyBase.OnPaint(e)
    CheckBoxRenderer.DrawCheckBox(e.Graphics, _
        Me.ClientRectangle.Location, TextRectangle, Me.Text, _
        Me.Font, TextFormatFlags.HorizontalCenter, _
        clicked, state)
End Sub

' Draw the check box in the checked or unchecked state, alternately.
Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
    MyBase.OnMouseDown(e)
    If Not clicked Then
        With Me
            .clicked = True
            .Text = "Clicked!"
            .state = CheckBoxState.CheckedPressed
        End With
        Invalidate()
    Else
        With Me
            .clicked = False
            .Text = "Click here"
            .state = CheckBoxState.UncheckedNormal
        End With
        Invalidate()
    End If
End Sub

Opmerkingen

Als visuele stijlen zijn ingeschakeld in het besturingssysteem en visuele stijlen worden toegepast op de huidige toepassing, wordt met deze methode het selectievakje getekend met de huidige visuele stijl. Anders wordt het selectievakje getekend met de klassieke stijl Windows.

Van toepassing op

DrawCheckBox(Graphics, Point, Rectangle, String, Font, Image, Rectangle, Boolean, CheckBoxState)

Bron:
CheckBoxRenderer.cs
Bron:
CheckBoxRenderer.cs
Bron:
CheckBoxRenderer.cs
Bron:
CheckBoxRenderer.cs
Bron:
CheckBoxRenderer.cs

Hiermee tekent u een selectievakje in de opgegeven status en locatie, met de opgegeven tekst en afbeelding en met een optionele focusrechthoek.

public:
 static void DrawCheckBox(System::Drawing::Graphics ^ g, System::Drawing::Point glyphLocation, System::Drawing::Rectangle textBounds, System::String ^ checkBoxText, System::Drawing::Font ^ font, System::Drawing::Image ^ image, System::Drawing::Rectangle imageBounds, bool focused, System::Windows::Forms::VisualStyles::CheckBoxState state);
public static void DrawCheckBox(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string checkBoxText, System.Drawing.Font font, System.Drawing.Image image, System.Drawing.Rectangle imageBounds, bool focused, System.Windows.Forms.VisualStyles.CheckBoxState state);
public static void DrawCheckBox(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string? checkBoxText, System.Drawing.Font? font, System.Drawing.Image image, System.Drawing.Rectangle imageBounds, bool focused, System.Windows.Forms.VisualStyles.CheckBoxState state);
static member DrawCheckBox : System.Drawing.Graphics * System.Drawing.Point * System.Drawing.Rectangle * string * System.Drawing.Font * System.Drawing.Image * System.Drawing.Rectangle * bool * System.Windows.Forms.VisualStyles.CheckBoxState -> unit
Public Shared Sub DrawCheckBox (g As Graphics, glyphLocation As Point, textBounds As Rectangle, checkBoxText As String, font As Font, image As Image, imageBounds As Rectangle, focused As Boolean, state As CheckBoxState)

Parameters

g
Graphics

Het Graphics selectievakje waarmee u het selectievakje tekent.

glyphLocation
Point

Het Point selectievakje waar u het selectievakje wilt tekenen.

textBounds
Rectangle

De Rectangle te tekenen checkBoxText .

checkBoxText
String

Het String selectievakje om met het selectievakje te tekenen.

font
Font

De Font toe te checkBoxTextpassen op .

image
Image

Het Image selectievakje om met het selectievakje te tekenen.

imageBounds
Rectangle

De Rectangle afmetingen van image.

focused
Boolean

true om een focusrechthoek te tekenen; anders, false.

state
CheckBoxState

Een van de CheckBoxState waarden waarmee de visuele status van het selectievakje wordt opgegeven.

Opmerkingen

Als visuele stijlen zijn ingeschakeld in het besturingssysteem en visuele stijlen worden toegepast op de huidige toepassing, wordt met deze methode het selectievakje getekend met de huidige visuele stijl. Anders wordt het selectievakje getekend met de klassieke stijl Windows.

Van toepassing op

DrawCheckBox(Graphics, Point, Rectangle, String, Font, TextFormatFlags, Image, Rectangle, Boolean, CheckBoxState)

Bron:
CheckBoxRenderer.cs
Bron:
CheckBoxRenderer.cs
Bron:
CheckBoxRenderer.cs
Bron:
CheckBoxRenderer.cs
Bron:
CheckBoxRenderer.cs

Hiermee tekent u een selectievakje in de opgegeven status en locatie; met de opgegeven tekst, tekstopmaak en afbeelding; en met een optionele focusrechthoek.

public:
 static void DrawCheckBox(System::Drawing::Graphics ^ g, System::Drawing::Point glyphLocation, System::Drawing::Rectangle textBounds, System::String ^ checkBoxText, System::Drawing::Font ^ font, System::Windows::Forms::TextFormatFlags flags, System::Drawing::Image ^ image, System::Drawing::Rectangle imageBounds, bool focused, System::Windows::Forms::VisualStyles::CheckBoxState state);
public static void DrawCheckBox(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string checkBoxText, System.Drawing.Font font, System.Windows.Forms.TextFormatFlags flags, System.Drawing.Image image, System.Drawing.Rectangle imageBounds, bool focused, System.Windows.Forms.VisualStyles.CheckBoxState state);
public static void DrawCheckBox(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string? checkBoxText, System.Drawing.Font? font, System.Windows.Forms.TextFormatFlags flags, System.Drawing.Image image, System.Drawing.Rectangle imageBounds, bool focused, System.Windows.Forms.VisualStyles.CheckBoxState state);
static member DrawCheckBox : System.Drawing.Graphics * System.Drawing.Point * System.Drawing.Rectangle * string * System.Drawing.Font * System.Windows.Forms.TextFormatFlags * System.Drawing.Image * System.Drawing.Rectangle * bool * System.Windows.Forms.VisualStyles.CheckBoxState -> unit
Public Shared Sub DrawCheckBox (g As Graphics, glyphLocation As Point, textBounds As Rectangle, checkBoxText As String, font As Font, flags As TextFormatFlags, image As Image, imageBounds As Rectangle, focused As Boolean, state As CheckBoxState)

Parameters

g
Graphics

Het Graphics selectievakje waarmee u het selectievakje tekent.

glyphLocation
Point

Het Point selectievakje waar u het selectievakje wilt tekenen.

textBounds
Rectangle

De Rectangle te tekenen checkBoxText .

checkBoxText
String

Het String selectievakje om met het selectievakje te tekenen.

font
Font

De Font toe te checkBoxTextpassen op .

flags
TextFormatFlags

Een bitsgewijze combinatie van de TextFormatFlags waarden.

image
Image

Het Image selectievakje om met het selectievakje te tekenen.

imageBounds
Rectangle

De Rectangle afmetingen van image.

focused
Boolean

true om een focusrechthoek te tekenen; anders, false.

state
CheckBoxState

Een van de CheckBoxState waarden waarmee de visuele status van het selectievakje wordt opgegeven.

Opmerkingen

Als visuele stijlen zijn ingeschakeld in het besturingssysteem en visuele stijlen worden toegepast op de huidige toepassing, wordt met deze methode het selectievakje getekend met de huidige visuele stijl. Anders wordt het selectievakje getekend met de klassieke stijl Windows.

Van toepassing op