Application.VisualStyleState Property

Definition

Gets a value that specifies how visual styles are applied to application windows.

public static System.Windows.Forms.VisualStyles.VisualStyleState VisualStyleState { get; set; }

Property Value

A bitwise combination of the VisualStyleState values.

Examples

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.

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);
}

Remarks

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.

Applies to

מוצר גירסאות
.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