Application.VisualStyleState Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a value that specifies how visual styles are applied to application windows.
public:
static property System::Windows::Forms::VisualStyles::VisualStyleState VisualStyleState { System::Windows::Forms::VisualStyles::VisualStyleState get(); void set(System::Windows::Forms::VisualStyles::VisualStyleState value); };
public static System.Windows.Forms.VisualStyles.VisualStyleState VisualStyleState { get; set; }
static member VisualStyleState : System.Windows.Forms.VisualStyles.VisualStyleState with get, set
Public Shared Property VisualStyleState As VisualStyleState
A bitwise combination of the VisualStyleState values.
The following code example sets the VisualStyleState property to one of the System.Windows.Forms.VisualStyles.VisualStyleState values within the Click event handler for a Button control. This code example is part of a larger example provided for the System.Windows.Forms.VisualStyles.VisualStyleState enumeration.
private:
void UpdateButton_Click(Object^ sender, EventArgs^ e)
{
if (applyToClient->Checked)
{
Application::VisualStyleState =
VisualStyleState::ClientAreaEnabled;
}
else if (applyToNonClient->Checked)
{
Application::VisualStyleState =
VisualStyleState::NonClientAreaEnabled;
}
else if (applyToAll->Checked)
{
Application::VisualStyleState =
VisualStyleState::ClientAndNonClientAreasEnabled;
}
else if (disableStyles->Checked)
{
Application::VisualStyleState =
VisualStyleState::NoneEnabled;
}
// Repaint the form and all child controls.
this->Invalidate(true);
}
void button1_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
Application.VisualStyleState =
VisualStyleState.ClientAreaEnabled;
}
else if (radioButton2.Checked)
{
Application.VisualStyleState =
VisualStyleState.NonClientAreaEnabled;
}
else if (radioButton3.Checked)
{
Application.VisualStyleState =
VisualStyleState.ClientAndNonClientAreasEnabled;
}
else if (radioButton4.Checked)
{
Application.VisualStyleState =
VisualStyleState.NoneEnabled;
}
// Repaint the form and all child controls.
this.Invalidate(true);
}
Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) _
Handles button1.Click
If radioButton1.Checked Then
Application.VisualStyleState = _
VisualStyleState.ClientAreaEnabled
ElseIf radioButton2.Checked Then
Application.VisualStyleState = _
VisualStyleState.NonClientAreaEnabled
ElseIf radioButton3.Checked Then
Application.VisualStyleState = _
VisualStyleState.ClientAndNonClientAreasEnabled
ElseIf radioButton4.Checked Then
Application.VisualStyleState = _
VisualStyleState.NoneEnabled
End If
' Repaint the form and all child controls.
Me.Invalidate(True)
End Sub
This VisualStyleState property determines whether visual styles are enabled in client areas or nonclient areas of application windows. Generally, this property should be set within the main form's constructor or Load event handler.
מוצר | גירסאות |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
משוב של .NET
.NET הוא פרויקט קוד פתוח. בחר קישור כדי לספק משוב: