TextBoxRenderer.DrawTextBox 메서드

정의

운영 체제의 현재 비주얼 스타일을 사용하여 텍스트 상자 컨트롤을 그립니다.

오버로드

DrawTextBox(Graphics, Rectangle, TextBoxState)

지정된 상태와 범위로 텍스트 상자 컨트롤을 그립니다.

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

지정된 텍스트를 사용하여 지정된 상태와 범위로 텍스트 상자 컨트롤을 그립니다.

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

지정된 텍스트와 텍스트 범위를 사용하여 지정된 상태와 범위로 텍스트 상자 컨트롤을 그립니다.

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

지정된 텍스트와 텍스트 서식을 사용하여 지정된 상태와 범위로 텍스트 상자 컨트롤을 그립니다.

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

지정된 텍스트, 텍스트 범위 및 텍스트 서식을 사용하여 지정된 상태와 범위로 텍스트 상자 컨트롤을 그립니다.

DrawTextBox(Graphics, Rectangle, TextBoxState)

지정된 상태와 범위로 텍스트 상자 컨트롤을 그립니다.

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)

매개 변수

g
Graphics

텍스트 상자를 그리는 데 사용되는 Graphics입니다.

bounds
Rectangle

텍스트 상자의 범위를 지정하는 Rectangle입니다.

state
TextBoxState

텍스트 상자의 표시 상태를 지정하는 TextBoxState 값 중 하나입니다.

예외

운영 체제에서 비주얼 스타일을 지원하지 않는 경우

또는

운영 체제에서 사용자가 비주얼 스타일을 사용하지 않도록 설정한 경우

또는

비주얼 스타일이 애플리케이션 창의 클라이언트 영역에 적용되지 않은 경우

설명

이 메서드를 호출 하기 전에 있는지 확인 해야 합니다 IsSupported 속성이 반환 true합니다.

적용 대상

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

지정된 텍스트를 사용하여 지정된 상태와 범위로 텍스트 상자 컨트롤을 그립니다.

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)

매개 변수

g
Graphics

텍스트 상자를 그리는 데 사용되는 Graphics입니다.

bounds
Rectangle

텍스트 상자의 범위를 지정하는 Rectangle입니다.

textBoxText
String

텍스트 상자에 그릴 String입니다.

font
Font

textBoxText에 적용할 Font입니다.

state
TextBoxState

텍스트 상자의 표시 상태를 지정하는 TextBoxState 값 중 하나입니다.

예외

운영 체제에서 비주얼 스타일을 지원하지 않는 경우

또는

운영 체제에서 사용자가 비주얼 스타일을 사용하지 않도록 설정한 경우

또는

비주얼 스타일이 애플리케이션 창의 클라이언트 영역에 적용되지 않은 경우

설명

이 메서드를 호출 하기 전에 있는지 확인 해야 합니다 IsSupported 속성이 반환 true합니다.

적용 대상

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

지정된 텍스트와 텍스트 범위를 사용하여 지정된 상태와 범위로 텍스트 상자 컨트롤을 그립니다.

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)

매개 변수

g
Graphics

텍스트 상자를 그리는 데 사용되는 Graphics입니다.

bounds
Rectangle

텍스트 상자의 범위를 지정하는 Rectangle입니다.

textBoxText
String

텍스트 상자에 그릴 String입니다.

font
Font

textBoxText에 적용할 Font입니다.

textBounds
Rectangle

textBoxText의 범위를 지정하는 Rectangle입니다.

state
TextBoxState

텍스트 상자의 표시 상태를 지정하는 TextBoxState 값 중 하나입니다.

예외

운영 체제에서 비주얼 스타일을 지원하지 않는 경우

또는

운영 체제에서 사용자가 비주얼 스타일을 사용하지 않도록 설정한 경우

또는

비주얼 스타일이 애플리케이션 창의 클라이언트 영역에 적용되지 않은 경우

설명

이 메서드를 호출 하기 전에 있는지 확인 해야 합니다 IsSupported 속성이 반환 true합니다.

적용 대상

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

지정된 텍스트와 텍스트 서식을 사용하여 지정된 상태와 범위로 텍스트 상자 컨트롤을 그립니다.

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)

매개 변수

g
Graphics

텍스트 상자를 그리는 데 사용되는 Graphics입니다.

bounds
Rectangle

텍스트 상자의 범위를 지정하는 Rectangle입니다.

textBoxText
String

텍스트 상자에 그릴 String입니다.

font
Font

textBoxText에 적용할 Font입니다.

flags
TextFormatFlags

TextFormatFlags 값의 비트 조합입니다.

state
TextBoxState

텍스트 상자의 표시 상태를 지정하는 TextBoxState 값 중 하나입니다.

예외

운영 체제에서 비주얼 스타일을 지원하지 않는 경우

또는

운영 체제에서 사용자가 비주얼 스타일을 사용하지 않도록 설정한 경우

또는

비주얼 스타일이 애플리케이션 창의 클라이언트 영역에 적용되지 않은 경우

설명

이 메서드를 호출 하기 전에 있는지 확인 해야 합니다 IsSupported 속성이 반환 true합니다.

적용 대상

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

지정된 텍스트, 텍스트 범위 및 텍스트 서식을 사용하여 지정된 상태와 범위로 텍스트 상자 컨트롤을 그립니다.

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)

매개 변수

g
Graphics

텍스트 상자를 그리는 데 사용되는 Graphics입니다.

bounds
Rectangle

텍스트 상자의 범위를 지정하는 Rectangle입니다.

textBoxText
String

텍스트 상자에 그릴 String입니다.

font
Font

textBoxText에 적용할 Font입니다.

textBounds
Rectangle

textBoxText의 범위를 지정하는 Rectangle입니다.

flags
TextFormatFlags

TextFormatFlags 값의 비트 조합입니다.

state
TextBoxState

텍스트 상자의 표시 상태를 지정하는 TextBoxState 값 중 하나입니다.

예외

운영 체제에서 비주얼 스타일을 지원하지 않는 경우

또는

운영 체제에서 사용자가 비주얼 스타일을 사용하지 않도록 설정한 경우

또는

비주얼 스타일이 애플리케이션 창의 클라이언트 영역에 적용되지 않은 경우

예제

다음 코드 예제를 사용 하는 방법에 설명 합니다 DrawTextBox(Graphics, Rectangle, String, Font, Rectangle, TextFormatFlags, TextBoxState) 메서드는 사용자 지정 컨트롤의 OnPaint 텍스트 상자를 그리는 방법입니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 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

설명

이 메서드를 호출 하기 전에 있는지 확인 해야 합니다 IsSupported 속성이 반환 true합니다.

적용 대상