VisualStyleState Enumeration
.NET Framework 3.0
Specifies how visual styles are applied to the current application.
Namespace: System.Windows.Forms.VisualStyles
Assembly: System.Windows.Forms (in system.windows.forms.dll)
Assembly: System.Windows.Forms (in system.windows.forms.dll)
| Member name | Description | |
|---|---|---|
| ClientAndNonClientAreasEnabled | Visual styles are applied to client and nonclient areas. | |
| ClientAreaEnabled | Visual styles are applied only to the client area. | |
| NonClientAreaEnabled | Visual styles are applied only to the nonclient area. | |
| NoneEnabled | Visual styles are not applied to the application. |
This enumeration is used by the Application.VisualStyleState property to specify whether visual styles are applied to client or nonclient areas of application windows.
The following code example is a simple program that applies visual styles in each of the four areas specified by the VisualStyleState values. To enable visual styles in a certain area, click the option button (also known as a radio button) that represents the area you want to enable, and click the Update VisualStyleState button to observe the changes in the window.
Imports System Imports System.Drawing Imports System.Windows.Forms Imports System.Windows.Forms.VisualStyles Namespace VisualStyleStateSample Class Form1 Inherits Form Private WithEvents button1 As New Button() Private radioButton1 As New RadioButton() Private radioButton2 As New RadioButton() Private radioButton3 As New RadioButton() Private radioButton4 As New RadioButton() Public Sub New() With button1 .AutoSize = True .Location = New Point(10, 10) .Text = "Update VisualStyleState" End With With radioButton1 .Location = New Point(10, 50) .AutoSize = True .Text = "Apply styles to client area only" End With With radioButton2 .Location = New Point(10, 70) .AutoSize = True .Text = "Apply styles to nonclient area only" End With With radioButton3 .Location = New Point(10, 90) .AutoSize = True .Text = "Apply styles to client and nonclient areas" End With With radioButton4 .Location = New Point(10, 110) .AutoSize = True .Text = "Disable styles in all areas" End With Me.Text = "VisualStyleState Test" Me.Controls.AddRange(New Control() {button1, radioButton1, _ radioButton2, radioButton3, radioButton4}) End Sub <STAThread()> _ Shared Sub Main() Application.EnableVisualStyles() Application.Run(New Form1()) End Sub 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 End Class End Namespace
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, 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.Community Additions
ADD
Show: