RadioButtonRenderer.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 属性来显示呈现样式根据应用程序状态而更改。 此代码示例是为类提供的大型示例的 RadioButtonRenderer 一部分。

private void button1_Click(object sender, EventArgs e)
{
    Application.VisualStyleState =
        Application.VisualStyleState ^
        VisualStyleState.ClientAndNonClientAreasEnabled;

    GroupBoxRenderer.RenderMatchingApplicationState = true;
    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

    RadioButtonRenderer.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

注解

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

适用于