Sdílet prostřednictvím


TextBoxRenderer.DrawTextBox Metoda

Definice

Nakreslí ovládací prvek textového pole s aktuálním vizuálním stylem operačního systému.

Přetížení

Name Description
DrawTextBox(Graphics, Rectangle, TextBoxState)

Nakreslí ovládací prvek textového pole v zadaném stavu a hranicích.

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

Nakreslí ovládací prvek textového pole v zadaném stavu a mezích a se zadaným textem.

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

Nakreslí ovládací prvek textového pole v zadaném stavu a mezích a se zadaným textem a ohraničeným textem.

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

Nakreslí ovládací prvek textového pole v zadaném stavu a mezích a se zadaným textem a formátováním textu.

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

Nakreslí ovládací prvek textového pole v zadaném stavu a mezích a se zadaným textem, ohraničením textu a formátováním textu.

DrawTextBox(Graphics, Rectangle, TextBoxState)

Zdroj:
TextBoxRenderer.cs
Zdroj:
TextBoxRenderer.cs
Zdroj:
TextBoxRenderer.cs
Zdroj:
TextBoxRenderer.cs
Zdroj:
TextBoxRenderer.cs

Nakreslí ovládací prvek textového pole v zadaném stavu a hranicích.

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)

Parametry

g
Graphics

Slouží Graphics k vykreslení textového pole.

bounds
Rectangle

Určuje Rectangle hranice textového pole.

state
TextBoxState

Jedna z TextBoxState hodnot, která určuje vizuální stav textového pole.

Výjimky

Operační systém nepodporuje vizuální styly.

nebo

Vizuální styly jsou zakázány uživatelem v operačním systému.

nebo

Styly vizuálů se nepoužívají v klientské oblasti oken aplikací.

Poznámky

Před voláním této metody byste měli ověřit, zda IsSupported vlastnost vrací true.

Platí pro

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

Zdroj:
TextBoxRenderer.cs
Zdroj:
TextBoxRenderer.cs
Zdroj:
TextBoxRenderer.cs
Zdroj:
TextBoxRenderer.cs
Zdroj:
TextBoxRenderer.cs

Nakreslí ovládací prvek textového pole v zadaném stavu a mezích a se zadaným textem.

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)

Parametry

g
Graphics

Slouží Graphics k vykreslení textového pole.

bounds
Rectangle

Určuje Rectangle hranice textového pole.

textBoxText
String

To String draw in the text box.

font
Font

To Font platí pro textBoxText.

state
TextBoxState

Jedna z TextBoxState hodnot, která určuje vizuální stav textového pole.

Výjimky

Operační systém nepodporuje vizuální styly.

nebo

Vizuální styly jsou zakázány uživatelem v operačním systému.

nebo

Styly vizuálů se nepoužívají v klientské oblasti oken aplikací.

Poznámky

Před voláním této metody byste měli ověřit, zda IsSupported vlastnost vrací true.

Platí pro

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

Zdroj:
TextBoxRenderer.cs
Zdroj:
TextBoxRenderer.cs
Zdroj:
TextBoxRenderer.cs
Zdroj:
TextBoxRenderer.cs
Zdroj:
TextBoxRenderer.cs

Nakreslí ovládací prvek textového pole v zadaném stavu a mezích a se zadaným textem a ohraničeným textem.

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)

Parametry

g
Graphics

Slouží Graphics k vykreslení textového pole.

bounds
Rectangle

Určuje Rectangle hranice textového pole.

textBoxText
String

To String draw in the text box.

font
Font

To Font platí pro textBoxText.

textBounds
Rectangle

Určuje Rectangle hranice textBoxText.

state
TextBoxState

Jedna z TextBoxState hodnot, která určuje vizuální stav textového pole.

Výjimky

Operační systém nepodporuje vizuální styly.

nebo

Vizuální styly jsou zakázány uživatelem v operačním systému.

nebo

Styly vizuálů se nepoužívají v klientské oblasti oken aplikací.

Poznámky

Před voláním této metody byste měli ověřit, zda IsSupported vlastnost vrací true.

Platí pro

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

Zdroj:
TextBoxRenderer.cs
Zdroj:
TextBoxRenderer.cs
Zdroj:
TextBoxRenderer.cs
Zdroj:
TextBoxRenderer.cs
Zdroj:
TextBoxRenderer.cs

Nakreslí ovládací prvek textového pole v zadaném stavu a mezích a se zadaným textem a formátováním textu.

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)

Parametry

g
Graphics

Slouží Graphics k vykreslení textového pole.

bounds
Rectangle

Určuje Rectangle hranice textového pole.

textBoxText
String

To String draw in the text box.

font
Font

To Font platí pro textBoxText.

flags
TextFormatFlags

Bitové kombinace TextFormatFlags hodnot.

state
TextBoxState

Jedna z TextBoxState hodnot, která určuje vizuální stav textového pole.

Výjimky

Operační systém nepodporuje vizuální styly.

nebo

Vizuální styly jsou zakázány uživatelem v operačním systému.

nebo

Styly vizuálů se nepoužívají v klientské oblasti oken aplikací.

Poznámky

Před voláním této metody byste měli ověřit, zda IsSupported vlastnost vrací true.

Platí pro

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

Zdroj:
TextBoxRenderer.cs
Zdroj:
TextBoxRenderer.cs
Zdroj:
TextBoxRenderer.cs
Zdroj:
TextBoxRenderer.cs
Zdroj:
TextBoxRenderer.cs

Nakreslí ovládací prvek textového pole v zadaném stavu a mezích a se zadaným textem, ohraničením textu a formátováním textu.

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)

Parametry

g
Graphics

Slouží Graphics k vykreslení textového pole.

bounds
Rectangle

Určuje Rectangle hranice textového pole.

textBoxText
String

To String draw in the text box.

font
Font

To Font platí pro textBoxText.

textBounds
Rectangle

Určuje Rectangle hranice textBoxText.

flags
TextFormatFlags

Bitové kombinace TextFormatFlags hodnot.

state
TextBoxState

Jedna z TextBoxState hodnot, která určuje vizuální stav textového pole.

Výjimky

Operační systém nepodporuje vizuální styly.

nebo

Vizuální styly jsou zakázány uživatelem v operačním systému.

nebo

Styly vizuálů se nepoužívají v klientské oblasti oken aplikací.

Příklady

Následující příklad kódu ukazuje, jak použít metodu DrawTextBox(Graphics, Rectangle, String, Font, Rectangle, TextFormatFlags, TextBoxState) v metodě vlastního ovládacího prvku OnPaint k vykreslení textového pole. Tento příklad kódu je součástí většího příkladu uvedeného pro třídu TextBoxRenderer.

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

Poznámky

Před voláním této metody byste měli ověřit, zda IsSupported vlastnost vrací true.

Platí pro