Export (0) Print
Expand All

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

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 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft