Bagikan melalui


TextBoxRenderer.DrawTextBox Metode

Definisi

Menggambar kontrol kotak teks dengan gaya visual sistem operasi saat ini.

Overload

Nama Deskripsi
DrawTextBox(Graphics, Rectangle, TextBoxState)

Menggambar kontrol kotak teks dalam status dan batas yang ditentukan.

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

Menggambar kontrol kotak teks dalam status dan batas yang ditentukan, dan dengan teks yang ditentukan.

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

Menggambar kontrol kotak teks dalam status dan batas yang ditentukan, dan dengan batas teks dan teks yang ditentukan.

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

Menggambar kontrol kotak teks dalam status dan batas yang ditentukan, dan dengan pemformatan teks dan teks yang ditentukan.

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

Menggambar kontrol kotak teks dalam status dan batas yang ditentukan, dan dengan teks, batas teks, dan pemformatan teks yang ditentukan.

DrawTextBox(Graphics, Rectangle, TextBoxState)

Sumber:
TextBoxRenderer.cs
Sumber:
TextBoxRenderer.cs
Sumber:
TextBoxRenderer.cs
Sumber:
TextBoxRenderer.cs
Sumber:
TextBoxRenderer.cs

Menggambar kontrol kotak teks dalam status dan batas yang ditentukan.

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)

Parameter

g
Graphics

yang Graphics digunakan untuk menggambar kotak teks.

bounds
Rectangle

Rectangle yang menentukan batas kotak teks.

state
TextBoxState

Salah TextBoxState satu nilai yang menentukan status visual kotak teks.

Pengecualian

Sistem operasi tidak mendukung gaya visual.

-atau-

Gaya visual dinonaktifkan oleh pengguna dalam sistem operasi.

-atau-

Gaya visual tidak diterapkan ke area klien jendela aplikasi.

Keterangan

Sebelum memanggil metode ini, Anda harus memverifikasi bahwa IsSupported properti mengembalikan true.

Berlaku untuk

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

Sumber:
TextBoxRenderer.cs
Sumber:
TextBoxRenderer.cs
Sumber:
TextBoxRenderer.cs
Sumber:
TextBoxRenderer.cs
Sumber:
TextBoxRenderer.cs

Menggambar kontrol kotak teks dalam status dan batas yang ditentukan, dan dengan teks yang ditentukan.

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)

Parameter

g
Graphics

yang Graphics digunakan untuk menggambar kotak teks.

bounds
Rectangle

Rectangle yang menentukan batas kotak teks.

textBoxText
String

untuk String menggambar dalam kotak teks.

font
Font

yang Font akan diterapkan ke textBoxText.

state
TextBoxState

Salah TextBoxState satu nilai yang menentukan status visual kotak teks.

Pengecualian

Sistem operasi tidak mendukung gaya visual.

-atau-

Gaya visual dinonaktifkan oleh pengguna dalam sistem operasi.

-atau-

Gaya visual tidak diterapkan ke area klien jendela aplikasi.

Keterangan

Sebelum memanggil metode ini, Anda harus memverifikasi bahwa IsSupported properti mengembalikan true.

Berlaku untuk

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

Sumber:
TextBoxRenderer.cs
Sumber:
TextBoxRenderer.cs
Sumber:
TextBoxRenderer.cs
Sumber:
TextBoxRenderer.cs
Sumber:
TextBoxRenderer.cs

Menggambar kontrol kotak teks dalam status dan batas yang ditentukan, dan dengan batas teks dan teks yang ditentukan.

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)

Parameter

g
Graphics

yang Graphics digunakan untuk menggambar kotak teks.

bounds
Rectangle

Rectangle yang menentukan batas kotak teks.

textBoxText
String

untuk String menggambar dalam kotak teks.

font
Font

yang Font akan diterapkan ke textBoxText.

textBounds
Rectangle

Rectangle yang menentukan batas .textBoxText

state
TextBoxState

Salah TextBoxState satu nilai yang menentukan status visual kotak teks.

Pengecualian

Sistem operasi tidak mendukung gaya visual.

-atau-

Gaya visual dinonaktifkan oleh pengguna dalam sistem operasi.

-atau-

Gaya visual tidak diterapkan ke area klien jendela aplikasi.

Keterangan

Sebelum memanggil metode ini, Anda harus memverifikasi bahwa IsSupported properti mengembalikan true.

Berlaku untuk

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

Sumber:
TextBoxRenderer.cs
Sumber:
TextBoxRenderer.cs
Sumber:
TextBoxRenderer.cs
Sumber:
TextBoxRenderer.cs
Sumber:
TextBoxRenderer.cs

Menggambar kontrol kotak teks dalam status dan batas yang ditentukan, dan dengan pemformatan teks dan teks yang ditentukan.

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)

Parameter

g
Graphics

yang Graphics digunakan untuk menggambar kotak teks.

bounds
Rectangle

Rectangle yang menentukan batas kotak teks.

textBoxText
String

untuk String menggambar dalam kotak teks.

font
Font

yang Font akan diterapkan ke textBoxText.

flags
TextFormatFlags

Kombinasi bitwise dari TextFormatFlags nilai.

state
TextBoxState

Salah TextBoxState satu nilai yang menentukan status visual kotak teks.

Pengecualian

Sistem operasi tidak mendukung gaya visual.

-atau-

Gaya visual dinonaktifkan oleh pengguna dalam sistem operasi.

-atau-

Gaya visual tidak diterapkan ke area klien jendela aplikasi.

Keterangan

Sebelum memanggil metode ini, Anda harus memverifikasi bahwa IsSupported properti mengembalikan true.

Berlaku untuk

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

Sumber:
TextBoxRenderer.cs
Sumber:
TextBoxRenderer.cs
Sumber:
TextBoxRenderer.cs
Sumber:
TextBoxRenderer.cs
Sumber:
TextBoxRenderer.cs

Menggambar kontrol kotak teks dalam status dan batas yang ditentukan, dan dengan teks, batas teks, dan pemformatan teks yang ditentukan.

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)

Parameter

g
Graphics

yang Graphics digunakan untuk menggambar kotak teks.

bounds
Rectangle

Rectangle yang menentukan batas kotak teks.

textBoxText
String

untuk String menggambar dalam kotak teks.

font
Font

yang Font akan diterapkan ke textBoxText.

textBounds
Rectangle

Rectangle yang menentukan batas .textBoxText

flags
TextFormatFlags

Kombinasi bitwise dari TextFormatFlags nilai.

state
TextBoxState

Salah TextBoxState satu nilai yang menentukan status visual kotak teks.

Pengecualian

Sistem operasi tidak mendukung gaya visual.

-atau-

Gaya visual dinonaktifkan oleh pengguna dalam sistem operasi.

-atau-

Gaya visual tidak diterapkan ke area klien jendela aplikasi.

Contoh

Contoh kode berikut menunjukkan cara menggunakan DrawTextBox(Graphics, Rectangle, String, Font, Rectangle, TextFormatFlags, TextBoxState) metode dalam metode kontrol OnPaint kustom untuk menggambar kotak teks. Contoh kode ini adalah bagian dari contoh yang lebih besar yang disediakan untuk TextBoxRenderer kelas .

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

Keterangan

Sebelum memanggil metode ini, Anda harus memverifikasi bahwa IsSupported properti mengembalikan true.

Berlaku untuk