GroupBoxRenderer.RenderMatchingApplicationState 属性

定义

获取或设置一个值,该值指示呈现器是否使用应用程序状态来确定呈现样式。

public:
 static property bool RenderMatchingApplicationState { bool get(); void set(bool value); };
public static bool RenderMatchingApplicationState { get; set; }
member this.RenderMatchingApplicationState : bool with get, set
Public Shared Property RenderMatchingApplicationState As Boolean

属性值

Boolean

如果使用应用程序状态确定呈现样式,则为 true;否则为 false。 默认值为 true

示例

下面的代码示例使用 RenderMatchingApplicationState 属性更改是否使用视觉样式呈现组框。 此代码示例是为 GroupBoxRenderer 类提供的一个更大示例的一部分。


// Match application style and toggle visual styles off
// and on for the application.
    private void button1_Click(object sender, EventArgs e)
    {
        GroupBoxRenderer.RenderMatchingApplicationState = true;
        Application.VisualStyleState = 
            Application.VisualStyleState ^ 
            VisualStyleState.ClientAndNonClientAreasEnabled;

        if (Application.RenderWithVisualStyles)
            this.Text = "Visual Styles Enabled";
        else
            this.Text = "Visual Styles Disabled";
    }
' Match application style and toggle visual styles off
' and on for the application.
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) _
    Handles button1.Click

    GroupBoxRenderer.RenderMatchingApplicationState = True

    Application.VisualStyleState = _
        Application.VisualStyleState Xor _
        VisualStyleState.ClientAndNonClientAreasEnabled

    If Application.RenderWithVisualStyles Then
        Me.Text = "Visual Styles Enabled"
    Else
        Me.Text = "Visual Styles Disabled"
    End If

End Sub

注解

true如果是RenderMatchingApplicationState,则GroupBoxRenderer使用设置来确定Application.RenderWithVisualStyles呈现样式。 false如果是RenderMatchingApplicationState,呈现器将始终使用视觉样式呈现。

适用于