This documentation is archived and is not being maintained.

Application.VisualStyleState Property

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

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public static VisualStyleState VisualStyleState { get; set; }
/** @property */
public static VisualStyleState get_VisualStyleState ()

/** @property */
public static void set_VisualStyleState (VisualStyleState value)

public static function get VisualStyleState () : VisualStyleState

public static function set VisualStyleState (value : VisualStyleState)

Not applicable.

Property Value

A bitwise combination of the System.Windows.Forms.VisualStyles.VisualStyleState values.

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.

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

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0
Show: