Partager via


TextBoxRenderer.DrawTextBox Méthode

Définition

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

Surcharges

Nom Description
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 les limites de texte et de texte spécifiées.

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 de 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, ainsi que le texte, les limites de texte et la mise en forme de texte spécifiés.

DrawTextBox(Graphics, Rectangle, TextBoxState)

Source:
TextBoxRenderer.cs
Source:
TextBoxRenderer.cs
Source:
TextBoxRenderer.cs
Source:
TextBoxRenderer.cs
Source:
TextBoxRenderer.cs

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

Utilisé Graphics pour dessiner la zone de texte.

bounds
Rectangle

Qui Rectangle spécifie les limites de la zone de texte.

state
TextBoxState

Une des TextBoxState valeurs 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 cliente 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)

Source:
TextBoxRenderer.cs
Source:
TextBoxRenderer.cs
Source:
TextBoxRenderer.cs
Source:
TextBoxRenderer.cs
Source:
TextBoxRenderer.cs

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

Utilisé Graphics pour dessiner la zone de texte.

bounds
Rectangle

Qui Rectangle spécifie les limites de la zone de texte.

textBoxText
String

Dessin String dans la zone de texte.

font
Font

À Font appliquer à textBoxText.

state
TextBoxState

Une des TextBoxState valeurs 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 cliente 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)

Source:
TextBoxRenderer.cs
Source:
TextBoxRenderer.cs
Source:
TextBoxRenderer.cs
Source:
TextBoxRenderer.cs
Source:
TextBoxRenderer.cs

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

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

Utilisé Graphics pour dessiner la zone de texte.

bounds
Rectangle

Qui Rectangle spécifie les limites de la zone de texte.

textBoxText
String

Dessin String dans la zone de texte.

font
Font

À Font appliquer à textBoxText.

textBounds
Rectangle

Qui Rectangle spécifie les limites de textBoxText.

state
TextBoxState

Une des TextBoxState valeurs 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 cliente 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)

Source:
TextBoxRenderer.cs
Source:
TextBoxRenderer.cs
Source:
TextBoxRenderer.cs
Source:
TextBoxRenderer.cs
Source:
TextBoxRenderer.cs

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

Utilisé Graphics pour dessiner la zone de texte.

bounds
Rectangle

Qui Rectangle spécifie les limites de la zone de texte.

textBoxText
String

Dessin String dans la zone de texte.

font
Font

À Font appliquer à textBoxText.

flags
TextFormatFlags

Combinaison au niveau du bit des TextFormatFlags valeurs.

state
TextBoxState

Une des TextBoxState valeurs 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 cliente 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)

Source:
TextBoxRenderer.cs
Source:
TextBoxRenderer.cs
Source:
TextBoxRenderer.cs
Source:
TextBoxRenderer.cs
Source:
TextBoxRenderer.cs

Dessine un contrôle de zone de texte dans l’état et les limites spécifiés, ainsi que le texte, les limites de texte et la mise en forme 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::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

Utilisé Graphics pour dessiner la zone de texte.

bounds
Rectangle

Qui Rectangle spécifie les limites de la zone de texte.

textBoxText
String

Dessin String dans la zone de texte.

font
Font

À Font appliquer à textBoxText.

textBounds
Rectangle

Qui Rectangle spécifie les limites de textBoxText.

flags
TextFormatFlags

Combinaison au niveau du bit des TextFormatFlags valeurs.

state
TextBoxState

Une des TextBoxState valeurs 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 cliente 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 à