GroupBoxRenderer.RenderMatchingApplicationState 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定值,指出產生器是否會使用應用程式狀態來判斷呈現樣式。
public:
static property bool RenderMatchingApplicationState { bool get(); void set(bool value); };
public static bool RenderMatchingApplicationState { get; set; }
static member RenderMatchingApplicationState : bool with get, set
Public Shared Property RenderMatchingApplicationState As 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
備註
如果 RenderMatchingApplicationState 為 true
,則會 GroupBoxRenderer 使用 的 Application.RenderWithVisualStyles 設定來判斷轉譯樣式。 如果 為 RenderMatchingApplicationStatefalse
,則轉譯器一律會使用視覺化樣式來轉譯。