TextBoxRenderer.DrawTextBox Metoda

Definicja

Rysuje kontrolkę pola tekstowego z bieżącym stylem wizualnym systemu operacyjnego.

Przeciążenia

DrawTextBox(Graphics, Rectangle, TextBoxState)

Rysuje kontrolkę pola tekstowego w określonym stanie i granicach.

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

Rysuje kontrolkę pola tekstowego w określonym stanie i granicach oraz z określonym tekstem.

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

Rysuje kontrolkę pola tekstowego w określonym stanie i granicach oraz z określonymi granicami tekstowymi i tekstowymi.

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

Rysuje kontrolkę pola tekstowego w określonym stanie i granicach oraz z określonym formatowaniem tekstu i tekstu.

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

Rysuje kontrolkę pola tekstowego w określonym stanie i granicach oraz z określonym tekstem, granicami tekstu i formatowaniem tekstu.

DrawTextBox(Graphics, Rectangle, TextBoxState)

Rysuje kontrolkę pola tekstowego w określonym stanie i granicach.

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

Użyte Graphics do narysowania pola tekstowego.

bounds
Rectangle

Element Rectangle określający granice pola tekstowego.

state
TextBoxState

Jedna z TextBoxState wartości określających stan wizualny pola tekstowego.

Wyjątki

System operacyjny nie obsługuje stylów wizualnych.

-lub-

Style wizualne są wyłączone przez użytkownika w systemie operacyjnym.

-lub-

Style wizualne nie są stosowane do obszaru klienta okien aplikacji.

Uwagi

Przed wywołaniem tej metody należy sprawdzić, czy IsSupported właściwość zwraca truewartość .

Dotyczy

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

Rysuje kontrolkę pola tekstowego w określonym stanie i granicach oraz z określonym tekstem.

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

Użyte Graphics do narysowania pola tekstowego.

bounds
Rectangle

Element Rectangle określający granice pola tekstowego.

textBoxText
String

Element String do rysowania w polu tekstowym.

font
Font

Element Font do zastosowania do textBoxText.

state
TextBoxState

Jedna z TextBoxState wartości określających stan wizualny pola tekstowego.

Wyjątki

System operacyjny nie obsługuje stylów wizualnych.

-lub-

Style wizualne są wyłączone przez użytkownika w systemie operacyjnym.

-lub-

Style wizualne nie są stosowane do obszaru klienta okien aplikacji.

Uwagi

Przed wywołaniem tej metody należy sprawdzić, czy IsSupported właściwość zwraca truewartość .

Dotyczy

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

Rysuje kontrolkę pola tekstowego w określonym stanie i granicach oraz z określonymi granicami tekstowymi i tekstowymi.

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

Użyte Graphics do narysowania pola tekstowego.

bounds
Rectangle

Element Rectangle określający granice pola tekstowego.

textBoxText
String

Element String do rysowania w polu tekstowym.

font
Font

Element Font do zastosowania do textBoxText.

textBounds
Rectangle

Element Rectangle określający granice .textBoxText

state
TextBoxState

Jedna z TextBoxState wartości określających stan wizualny pola tekstowego.

Wyjątki

System operacyjny nie obsługuje stylów wizualnych.

-lub-

Style wizualne są wyłączone przez użytkownika w systemie operacyjnym.

-lub-

Style wizualne nie są stosowane do obszaru klienta okien aplikacji.

Uwagi

Przed wywołaniem tej metody należy sprawdzić, czy IsSupported właściwość zwraca truewartość .

Dotyczy

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

Rysuje kontrolkę pola tekstowego w określonym stanie i granicach oraz z określonym formatowaniem tekstu i tekstu.

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

Użyte Graphics do narysowania pola tekstowego.

bounds
Rectangle

Element Rectangle określający granice pola tekstowego.

textBoxText
String

Element String do rysowania w polu tekstowym.

font
Font

Element Font do zastosowania do textBoxText.

flags
TextFormatFlags

Bitowa kombinacja TextFormatFlags wartości.

state
TextBoxState

Jedna z TextBoxState wartości określających stan wizualny pola tekstowego.

Wyjątki

System operacyjny nie obsługuje stylów wizualnych.

-lub-

Style wizualne są wyłączone przez użytkownika w systemie operacyjnym.

-lub-

Style wizualne nie są stosowane do obszaru klienta okien aplikacji.

Uwagi

Przed wywołaniem tej metody należy sprawdzić, czy IsSupported właściwość zwraca truewartość .

Dotyczy

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

Rysuje kontrolkę pola tekstowego w określonym stanie i granicach oraz z określonym tekstem, granicami tekstu i formatowaniem tekstu.

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

Użyte Graphics do narysowania pola tekstowego.

bounds
Rectangle

Element Rectangle określający granice pola tekstowego.

textBoxText
String

Element String do rysowania w polu tekstowym.

font
Font

Element Font do zastosowania do textBoxText.

textBounds
Rectangle

Element Rectangle określający granice .textBoxText

flags
TextFormatFlags

Bitowa kombinacja TextFormatFlags wartości.

state
TextBoxState

Jedna z TextBoxState wartości określających stan wizualny pola tekstowego.

Wyjątki

System operacyjny nie obsługuje stylów wizualnych.

-lub-

Style wizualne są wyłączone przez użytkownika w systemie operacyjnym.

-lub-

Style wizualne nie są stosowane do obszaru klienta okien aplikacji.

Przykłady

Poniższy przykład kodu przedstawia sposób użycia DrawTextBox(Graphics, Rectangle, String, Font, Rectangle, TextFormatFlags, TextBoxState) metody w metodzie niestandardowej kontrolki OnPaint w celu narysowania pola tekstowego. Ten przykład kodu jest częścią większego przykładu podanego TextBoxRenderer dla klasy.

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

Uwagi

Przed wywołaniem tej metody należy sprawdzić, czy IsSupported właściwość zwraca truewartość .

Dotyczy