TextBoxRenderer.DrawTextBox Méthode

Définition

Dessine un contrôle de zone de texte avec le style visuel actif du système d'exploitation.

Surcharges

DrawTextBox(Graphics, Rectangle, TextBoxState)

Dessine un contrôle de zone de texte dans l'état et les limites spécifiés.

DrawTextBox(Graphics, Rectangle, String, Font, TextBoxState)

Dessine un contrôle de zone de texte dans l'état et les limites spécifiés et avec le texte spécifié.

DrawTextBox(Graphics, Rectangle, String, Font, Rectangle, TextBoxState)

Dessine un contrôle de zone de texte dans l'état et les limites spécifiés et avec le texte et les limites de texte spécifiés.

DrawTextBox(Graphics, Rectangle, String, Font, TextFormatFlags, TextBoxState)

Dessine un contrôle de zone de texte dans l'état et les limites spécifiés et avec le texte et la mise en forme du texte spécifiés.

DrawTextBox(Graphics, Rectangle, String, Font, Rectangle, TextFormatFlags, TextBoxState)

Dessine un contrôle de zone de texte dans l'état et les limites spécifiés et avec le texte, les limites de texte et la mise en forme du texte spécifiés.

DrawTextBox(Graphics, Rectangle, TextBoxState)

Dessine un contrôle de zone de texte dans l'état et les limites spécifiés.

public:
 static void DrawTextBox(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::Windows::Forms::VisualStyles::TextBoxState state);
public static void DrawTextBox (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Windows.Forms.VisualStyles.TextBoxState state);
static member DrawTextBox : System.Drawing.Graphics * System.Drawing.Rectangle * System.Windows.Forms.VisualStyles.TextBoxState -> unit
Public Shared Sub DrawTextBox (g As Graphics, bounds As Rectangle, state As TextBoxState)

Paramètres

g
Graphics

Graphics utilisé pour dessiner la zone de texte.

bounds
Rectangle

Rectangle qui représente les limites de la zone de texte

state
TextBoxState

Une des valeurs TextBoxState qui spécifie l'état visuel de la zone de texte.

Exceptions

Le système d'exploitation ne prend pas en charge les styles visuels.

  • ou -

Les styles visuels sont désactivés par l'utilisateur dans le système d'exploitation.

  • ou -

Les styles visuels ne sont pas appliqués à la zone client des fenêtres d'application.

Remarques

Avant d’appeler cette méthode, vous devez vérifier que la IsSupported propriété retourne true.

S’applique à

DrawTextBox(Graphics, Rectangle, String, Font, TextBoxState)

Dessine un contrôle de zone de texte dans l'état et les limites spécifiés et avec le texte spécifié.

public:
 static void DrawTextBox(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::String ^ textBoxText, System::Drawing::Font ^ font, System::Windows::Forms::VisualStyles::TextBoxState state);
public static void DrawTextBox (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string textBoxText, System.Drawing.Font font, System.Windows.Forms.VisualStyles.TextBoxState state);
public static void DrawTextBox (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string? textBoxText, System.Drawing.Font? font, System.Windows.Forms.VisualStyles.TextBoxState state);
static member DrawTextBox : System.Drawing.Graphics * System.Drawing.Rectangle * string * System.Drawing.Font * System.Windows.Forms.VisualStyles.TextBoxState -> unit
Public Shared Sub DrawTextBox (g As Graphics, bounds As Rectangle, textBoxText As String, font As Font, state As TextBoxState)

Paramètres

g
Graphics

Graphics utilisé pour dessiner la zone de texte.

bounds
Rectangle

Rectangle qui représente les limites de la zone de texte

textBoxText
String

String à dessiner dans la zone de texte.

font
Font

Font à appliquer aux textBoxText.

state
TextBoxState

Une des valeurs TextBoxState qui spécifie l'état visuel de la zone de texte.

Exceptions

Le système d'exploitation ne prend pas en charge les styles visuels.

  • ou -

Les styles visuels sont désactivés par l'utilisateur dans le système d'exploitation.

  • ou -

Les styles visuels ne sont pas appliqués à la zone client des fenêtres d'application.

Remarques

Avant d’appeler cette méthode, vous devez vérifier que la IsSupported propriété retourne true.

S’applique à

DrawTextBox(Graphics, Rectangle, String, Font, Rectangle, TextBoxState)

Dessine un contrôle de zone de texte dans l'état et les limites spécifiés et avec le texte et les limites de texte spécifiés.

public:
 static void DrawTextBox(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::String ^ textBoxText, System::Drawing::Font ^ font, System::Drawing::Rectangle textBounds, System::Windows::Forms::VisualStyles::TextBoxState state);
public static void DrawTextBox (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string textBoxText, System.Drawing.Font font, System.Drawing.Rectangle textBounds, System.Windows.Forms.VisualStyles.TextBoxState state);
public static void DrawTextBox (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string? textBoxText, System.Drawing.Font? font, System.Drawing.Rectangle textBounds, System.Windows.Forms.VisualStyles.TextBoxState state);
static member DrawTextBox : System.Drawing.Graphics * System.Drawing.Rectangle * string * System.Drawing.Font * System.Drawing.Rectangle * System.Windows.Forms.VisualStyles.TextBoxState -> unit
Public Shared Sub DrawTextBox (g As Graphics, bounds As Rectangle, textBoxText As String, font As Font, textBounds As Rectangle, state As TextBoxState)

Paramètres

g
Graphics

Graphics utilisé pour dessiner la zone de texte.

bounds
Rectangle

Rectangle qui représente les limites de la zone de texte

textBoxText
String

String à dessiner dans la zone de texte.

font
Font

Font à appliquer aux textBoxText.

textBounds
Rectangle

Rectangle qui spécifie les limites de textBoxText.

state
TextBoxState

Une des valeurs TextBoxState qui spécifie l'état visuel de la zone de texte.

Exceptions

Le système d'exploitation ne prend pas en charge les styles visuels.

  • ou -

Les styles visuels sont désactivés par l'utilisateur dans le système d'exploitation.

  • ou -

Les styles visuels ne sont pas appliqués à la zone client des fenêtres d'application.

Remarques

Avant d’appeler cette méthode, vous devez vérifier que la IsSupported propriété retourne true.

S’applique à

DrawTextBox(Graphics, Rectangle, String, Font, TextFormatFlags, TextBoxState)

Dessine un contrôle de zone de texte dans l'état et les limites spécifiés et avec le texte et la mise en forme du texte spécifiés.

public:
 static void DrawTextBox(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::String ^ textBoxText, System::Drawing::Font ^ font, System::Windows::Forms::TextFormatFlags flags, System::Windows::Forms::VisualStyles::TextBoxState state);
public static void DrawTextBox (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string textBoxText, System.Drawing.Font font, System.Windows.Forms.TextFormatFlags flags, System.Windows.Forms.VisualStyles.TextBoxState state);
public static void DrawTextBox (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string? textBoxText, System.Drawing.Font? font, System.Windows.Forms.TextFormatFlags flags, System.Windows.Forms.VisualStyles.TextBoxState state);
static member DrawTextBox : System.Drawing.Graphics * System.Drawing.Rectangle * string * System.Drawing.Font * System.Windows.Forms.TextFormatFlags * System.Windows.Forms.VisualStyles.TextBoxState -> unit
Public Shared Sub DrawTextBox (g As Graphics, bounds As Rectangle, textBoxText As String, font As Font, flags As TextFormatFlags, state As TextBoxState)

Paramètres

g
Graphics

Graphics utilisé pour dessiner la zone de texte.

bounds
Rectangle

Rectangle qui représente les limites de la zone de texte

textBoxText
String

String à dessiner dans la zone de texte.

font
Font

Font à appliquer aux textBoxText.

flags
TextFormatFlags

Combinaison d'opérations de bits des valeurs TextFormatFlags.

state
TextBoxState

Une des valeurs TextBoxState qui spécifie l'état visuel de la zone de texte.

Exceptions

Le système d'exploitation ne prend pas en charge les styles visuels.

  • ou -

Les styles visuels sont désactivés par l'utilisateur dans le système d'exploitation.

  • ou -

Les styles visuels ne sont pas appliqués à la zone client des fenêtres d'application.

Remarques

Avant d’appeler cette méthode, vous devez vérifier que la IsSupported propriété retourne true.

S’applique à

DrawTextBox(Graphics, Rectangle, String, Font, Rectangle, TextFormatFlags, TextBoxState)

Dessine un contrôle de zone de texte dans l'état et les limites spécifiés et avec le texte, les limites de texte et la mise en forme du texte spécifiés.

public:
 static void DrawTextBox(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::String ^ textBoxText, System::Drawing::Font ^ font, System::Drawing::Rectangle textBounds, System::Windows::Forms::TextFormatFlags flags, System::Windows::Forms::VisualStyles::TextBoxState state);
public static void DrawTextBox (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string textBoxText, System.Drawing.Font font, System.Drawing.Rectangle textBounds, System.Windows.Forms.TextFormatFlags flags, System.Windows.Forms.VisualStyles.TextBoxState state);
public static void DrawTextBox (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string? textBoxText, System.Drawing.Font? font, System.Drawing.Rectangle textBounds, System.Windows.Forms.TextFormatFlags flags, System.Windows.Forms.VisualStyles.TextBoxState state);
static member DrawTextBox : System.Drawing.Graphics * System.Drawing.Rectangle * string * System.Drawing.Font * System.Drawing.Rectangle * System.Windows.Forms.TextFormatFlags * System.Windows.Forms.VisualStyles.TextBoxState -> unit
Public Shared Sub DrawTextBox (g As Graphics, bounds As Rectangle, textBoxText As String, font As Font, textBounds As Rectangle, flags As TextFormatFlags, state As TextBoxState)

Paramètres

g
Graphics

Graphics utilisé pour dessiner la zone de texte.

bounds
Rectangle

Rectangle qui représente les limites de la zone de texte

textBoxText
String

String à dessiner dans la zone de texte.

font
Font

Font à appliquer aux textBoxText.

textBounds
Rectangle

Rectangle qui spécifie les limites de textBoxText.

flags
TextFormatFlags

Combinaison d'opérations de bits des valeurs TextFormatFlags.

state
TextBoxState

Une des valeurs TextBoxState qui spécifie l'état visuel de la zone de texte.

Exceptions

Le système d'exploitation ne prend pas en charge les styles visuels.

  • ou -

Les styles visuels sont désactivés par l'utilisateur dans le système d'exploitation.

  • ou -

Les styles visuels ne sont pas appliqués à la zone client des fenêtres d'application.

Exemples

L’exemple de code suivant montre comment utiliser la méthode dans la DrawTextBox(Graphics, Rectangle, String, Font, Rectangle, TextFormatFlags, TextBoxState) méthode d’un contrôle personnalisé pour dessiner une zone de OnPaint texte. Cet exemple de code fait partie d’un exemple plus grand fourni pour la TextBoxRenderer classe.

    // Use DrawText with the current TextFormatFlags.

protected:
    virtual void OnPaint(PaintEventArgs^ e) override
    {
        __super::OnPaint(e);

        if (TextBoxRenderer::IsSupported)
        {
            TextBoxRenderer::DrawTextBox(e->Graphics, textBorder, this->Text,
                this->Font, textRectangle, textFlags, TextBoxState::Normal);

            this->Parent->Text = "CustomTextBox Enabled";
        }
        else
        {
            this->Parent->Text = "CustomTextBox Disabled";
        }
    }
// Use DrawText with the current TextFormatFlags.
protected override void OnPaint(PaintEventArgs e)
{
    base.OnPaint(e);

    if (TextBoxRenderer.IsSupported)
    {
        TextBoxRenderer.DrawTextBox(e.Graphics, textBorder, this.Text,
            this.Font, textRectangle, textFlags, TextBoxState.Normal);

        this.Parent.Text = "CustomTextBox Enabled";
    }
    else
    {
        this.Parent.Text = "CustomTextBox Disabled";
    }
}
' Use DrawText with the current TextFormatFlags.
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
    MyBase.OnPaint(e)

    If TextBoxRenderer.IsSupported Then
        TextBoxRenderer.DrawTextBox(e.Graphics, textBorder, Me.Text, _
            Me.Font, textRectangle, textFlags, TextBoxState.Normal)
        Me.Parent.Text = "CustomTextBox Enabled"
    Else
        Me.Parent.Text = "CustomTextBox Disabled"
    End If
End Sub

Remarques

Avant d’appeler cette méthode, vous devez vérifier que la IsSupported propriété retourne true.

S’applique à