TextBoxRenderer.DrawTextBox メソッド

定義

オペレーティング システムの現在の visual スタイルを使用して、テキスト ボックス コントロールを描画します。

オーバーロード

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 値の 1 つ。

例外

オペレーティング システムが visual スタイルをサポートしていません。

または

visual スタイルは、オペレーティング システムのユーザーにより無効にされています。

または

visual スタイルは、アプリケーション ウィンドウのクライアント領域には適用されません。

注釈

このメソッドを呼び出す前に、 プロパティから が 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 値の 1 つ。

例外

オペレーティング システムが visual スタイルをサポートしていません。

または

visual スタイルは、オペレーティング システムのユーザーにより無効にされています。

または

visual スタイルは、アプリケーション ウィンドウのクライアント領域には適用されません。

注釈

このメソッドを呼び出す前に、 プロパティから が 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 値の 1 つ。

例外

オペレーティング システムが visual スタイルをサポートしていません。

または

visual スタイルは、オペレーティング システムのユーザーにより無効にされています。

または

visual スタイルは、アプリケーション ウィンドウのクライアント領域には適用されません。

注釈

このメソッドを呼び出す前に、 プロパティから が 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 値の 1 つ。

例外

オペレーティング システムが visual スタイルをサポートしていません。

または

visual スタイルは、オペレーティング システムのユーザーにより無効にされています。

または

visual スタイルは、アプリケーション ウィンドウのクライアント領域には適用されません。

注釈

このメソッドを呼び出す前に、 プロパティから が 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 値の 1 つ。

例外

オペレーティング システムが visual スタイルをサポートしていません。

または

visual スタイルは、オペレーティング システムのユーザーにより無効にされています。

または

visual スタイルは、アプリケーション ウィンドウのクライアント領域には適用されません。

次のコード例では、カスタム コントロールOnPaintDrawTextBox(Graphics, Rectangle, String, Font, Rectangle, TextFormatFlags, TextBoxState) メソッドで メソッドを使用してテキスト ボックスを描画する方法を示します。 このコード例は、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必要があります。

適用対象