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í

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 hranicí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 hranicích a se zadaným textem a hranicemi textu.

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

Nakreslí ovládací prvek textového pole v zadaném stavu a hranicí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 hranicích a se zadaným textem, ohraničením textu a formátováním textu.

DrawTextBox(Graphics, Rectangle, TextBoxState)

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

Používá Graphics se k kreslení textového pole.

bounds
Rectangle

Určuje Rectangle hranice textového pole.

state
TextBoxState

Jedna z TextBoxState hodnot, které určují stav vizuálu 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-

Vizuální styly se nepoužívají v oblasti klienta oken aplikací.

Poznámky

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

Platí pro

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

Nakreslí ovládací prvek textového pole v zadaném stavu a hranicí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

Používá Graphics se k kreslení textového pole.

bounds
Rectangle

Určuje Rectangle hranice textového pole.

textBoxText
String

Nakreslete String ho do textového pole.

font
Font

Platí Font pro textBoxText.

state
TextBoxState

Jedna z TextBoxState hodnot, které určují stav vizuálu 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-

Vizuální styly se nepoužívají v oblasti klienta oken aplikací.

Poznámky

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

Platí pro

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

Nakreslí ovládací prvek textového pole v zadaném stavu a hranicích a se zadaným textem a hranicemi 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::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

Používá Graphics se k kreslení textového pole.

bounds
Rectangle

Určuje Rectangle hranice textového pole.

textBoxText
String

Nakreslete String ho do textového pole.

font
Font

Platí Font pro textBoxText.

textBounds
Rectangle

Určuje Rectangle hranice .textBoxText

state
TextBoxState

Jedna z TextBoxState hodnot, které určují stav vizuálu 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-

Vizuální styly se nepoužívají v oblasti klienta oken aplikací.

Poznámky

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

Platí pro

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

Nakreslí ovládací prvek textového pole v zadaném stavu a hranicí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

Používá Graphics se k kreslení textového pole.

bounds
Rectangle

Určuje Rectangle hranice textového pole.

textBoxText
String

Nakreslete String ho do textového pole.

font
Font

Platí Font pro textBoxText.

flags
TextFormatFlags

Bitové kombinace TextFormatFlags hodnot.

state
TextBoxState

Jedna z TextBoxState hodnot, které určují stav vizuálu 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-

Vizuální styly se nepoužívají v oblasti klienta oken aplikací.

Poznámky

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

Platí pro

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

Nakreslí ovládací prvek textového pole v zadaném stavu a hranicí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

Používá Graphics se k kreslení textového pole.

bounds
Rectangle

Určuje Rectangle hranice textového pole.

textBoxText
String

Nakreslete String ho do textového pole.

font
Font

Platí Font pro textBoxText.

textBounds
Rectangle

Určuje Rectangle hranice .textBoxText

flags
TextFormatFlags

Bitové kombinace TextFormatFlags hodnot.

state
TextBoxState

Jedna z TextBoxState hodnot, které určují stav vizuálu 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-

Vizuální styly se nepoužívají v oblasti klienta 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 kreslení textového pole. Tento příklad kódu je součástí většího příkladu zadaného TextBoxRenderer pro třídu.

    // 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, že IsSupported vlastnost vrátí true.

Platí pro