TextBoxRenderer.IsSupported 属性    
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取一个值,该值指示 TextBoxRenderer 类是否可用于绘制具有视觉样式的文本框。
public:
 static property bool IsSupported { bool get(); };
	public static bool IsSupported { get; }
	member this.IsSupported : bool
	Public Shared ReadOnly Property IsSupported As Boolean
	属性值
如果用户已在操作系统中启用了视觉样式,并将视觉样式应用于应用程序窗口的工作区,则为 true;否则为 false。
示例
下面的代码示例使用 IsSupported 属性来确定是否使用 DrawTextBox 该方法。 此代码示例是为 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
	注解
如果此属性是 false,则 DrawTextBox 该方法将引发一个 InvalidOperationException。