Condividi tramite


TextBoxRenderer.DrawTextBox Metodo

Definizione

Disegna un controllo casella di testo con lo stile di visualizzazione corrente del sistema operativo.

Overload

Nome Descrizione
DrawTextBox(Graphics, Rectangle, TextBoxState)

Disegna un controllo casella di testo nello stato e nei limiti specificati.

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

Disegna un controllo casella di testo nello stato e nei limiti specificati e con il testo specificato.

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

Disegna un controllo casella di testo nello stato e nei limiti specificati e con il testo e i limiti di testo specificati.

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

Disegna un controllo casella di testo nello stato e nei limiti specificati e con il testo e la formattazione del testo specificati.

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

Disegna un controllo casella di testo nello stato e nei limiti specificati e con il testo, i limiti di testo e la formattazione del testo specificati.

DrawTextBox(Graphics, Rectangle, TextBoxState)

Origine:
TextBoxRenderer.cs
Origine:
TextBoxRenderer.cs
Origine:
TextBoxRenderer.cs
Origine:
TextBoxRenderer.cs
Origine:
TextBoxRenderer.cs

Disegna un controllo casella di testo nello stato e nei limiti specificati.

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)

Parametri

g
Graphics

Oggetto Graphics utilizzato per disegnare la casella di testo.

bounds
Rectangle

Oggetto Rectangle che specifica i limiti della casella di testo.

state
TextBoxState

Uno dei TextBoxState valori che specifica lo stato di visualizzazione della casella di testo.

Eccezioni

Il sistema operativo non supporta gli stili di visualizzazione.

oppure

Gli stili di visualizzazione sono disabilitati dall'utente nel sistema operativo.

oppure

Gli stili di visualizzazione non vengono applicati all'area client delle finestre dell'applicazione.

Commenti

Prima di chiamare questo metodo, è necessario verificare che la IsSupported proprietà restituisca true.

Si applica a

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

Origine:
TextBoxRenderer.cs
Origine:
TextBoxRenderer.cs
Origine:
TextBoxRenderer.cs
Origine:
TextBoxRenderer.cs
Origine:
TextBoxRenderer.cs

Disegna un controllo casella di testo nello stato e nei limiti specificati e con il testo specificato.

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)

Parametri

g
Graphics

Oggetto Graphics utilizzato per disegnare la casella di testo.

bounds
Rectangle

Oggetto Rectangle che specifica i limiti della casella di testo.

textBoxText
String

Oggetto String da disegnare nella casella di testo.

font
Font

Oggetto Font da applicare a textBoxText.

state
TextBoxState

Uno dei TextBoxState valori che specifica lo stato di visualizzazione della casella di testo.

Eccezioni

Il sistema operativo non supporta gli stili di visualizzazione.

oppure

Gli stili di visualizzazione sono disabilitati dall'utente nel sistema operativo.

oppure

Gli stili di visualizzazione non vengono applicati all'area client delle finestre dell'applicazione.

Commenti

Prima di chiamare questo metodo, è necessario verificare che la IsSupported proprietà restituisca true.

Si applica a

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

Origine:
TextBoxRenderer.cs
Origine:
TextBoxRenderer.cs
Origine:
TextBoxRenderer.cs
Origine:
TextBoxRenderer.cs
Origine:
TextBoxRenderer.cs

Disegna un controllo casella di testo nello stato e nei limiti specificati e con il testo e i limiti di testo specificati.

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)

Parametri

g
Graphics

Oggetto Graphics utilizzato per disegnare la casella di testo.

bounds
Rectangle

Oggetto Rectangle che specifica i limiti della casella di testo.

textBoxText
String

Oggetto String da disegnare nella casella di testo.

font
Font

Oggetto Font da applicare a textBoxText.

textBounds
Rectangle

Oggetto Rectangle che specifica i limiti di textBoxText.

state
TextBoxState

Uno dei TextBoxState valori che specifica lo stato di visualizzazione della casella di testo.

Eccezioni

Il sistema operativo non supporta gli stili di visualizzazione.

oppure

Gli stili di visualizzazione sono disabilitati dall'utente nel sistema operativo.

oppure

Gli stili di visualizzazione non vengono applicati all'area client delle finestre dell'applicazione.

Commenti

Prima di chiamare questo metodo, è necessario verificare che la IsSupported proprietà restituisca true.

Si applica a

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

Origine:
TextBoxRenderer.cs
Origine:
TextBoxRenderer.cs
Origine:
TextBoxRenderer.cs
Origine:
TextBoxRenderer.cs
Origine:
TextBoxRenderer.cs

Disegna un controllo casella di testo nello stato e nei limiti specificati e con il testo e la formattazione del testo specificati.

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)

Parametri

g
Graphics

Oggetto Graphics utilizzato per disegnare la casella di testo.

bounds
Rectangle

Oggetto Rectangle che specifica i limiti della casella di testo.

textBoxText
String

Oggetto String da disegnare nella casella di testo.

font
Font

Oggetto Font da applicare a textBoxText.

flags
TextFormatFlags

Combinazione bit per bit dei TextFormatFlags valori.

state
TextBoxState

Uno dei TextBoxState valori che specifica lo stato di visualizzazione della casella di testo.

Eccezioni

Il sistema operativo non supporta gli stili di visualizzazione.

oppure

Gli stili di visualizzazione sono disabilitati dall'utente nel sistema operativo.

oppure

Gli stili di visualizzazione non vengono applicati all'area client delle finestre dell'applicazione.

Commenti

Prima di chiamare questo metodo, è necessario verificare che la IsSupported proprietà restituisca true.

Si applica a

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

Origine:
TextBoxRenderer.cs
Origine:
TextBoxRenderer.cs
Origine:
TextBoxRenderer.cs
Origine:
TextBoxRenderer.cs
Origine:
TextBoxRenderer.cs

Disegna un controllo casella di testo nello stato e nei limiti specificati e con il testo, i limiti di testo e la formattazione del testo specificati.

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)

Parametri

g
Graphics

Oggetto Graphics utilizzato per disegnare la casella di testo.

bounds
Rectangle

Oggetto Rectangle che specifica i limiti della casella di testo.

textBoxText
String

Oggetto String da disegnare nella casella di testo.

font
Font

Oggetto Font da applicare a textBoxText.

textBounds
Rectangle

Oggetto Rectangle che specifica i limiti di textBoxText.

flags
TextFormatFlags

Combinazione bit per bit dei TextFormatFlags valori.

state
TextBoxState

Uno dei TextBoxState valori che specifica lo stato di visualizzazione della casella di testo.

Eccezioni

Il sistema operativo non supporta gli stili di visualizzazione.

oppure

Gli stili di visualizzazione sono disabilitati dall'utente nel sistema operativo.

oppure

Gli stili di visualizzazione non vengono applicati all'area client delle finestre dell'applicazione.

Esempio

Nell'esempio di codice seguente viene illustrato come utilizzare il DrawTextBox(Graphics, Rectangle, String, Font, Rectangle, TextFormatFlags, TextBoxState) metodo nel metodo di OnPaint un controllo personalizzato per disegnare una casella di testo. Questo esempio di codice fa parte di un esempio più ampio fornito per 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

Commenti

Prima di chiamare questo metodo, è necessario verificare che la IsSupported proprietà restituisca true.

Si applica a