Export (0) Print
Expand All

Application.VisualStyleState Property

Note: This property is new in the .NET Framework version 2.0.

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)

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 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 .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft