This documentation is archived and is not being maintained.

VisualStyleInformation Class

Provides information about the current visual style of the operating system.

Namespace:  System.Windows.Forms.VisualStyles
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public static class VisualStyleInformation

This class exposes static properties that provide details about the current visual style of the operating system.

Windows XP Home Edition, Windows XP Professional x64 Edition, Windows Server 2003 Platform Note: Visual styles are supported only on these platforms.

The following code example displays the values of the VisualStyleInformation properties in a ListView control.

// This is a simple example for VisualStyleInformation that displays 
// all of the visual style values in a ListView. 

using System;
using System.Drawing;
using System.Text;
using System.Reflection;
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;

namespace VisualStyleInformationSample
	public class Form1 : Form
		private ListView listView1 = new ListView();

		static void Main()
			Application.Run(new Form1());

		public Form1()
			this.ClientSize = new Size(500, 500);
			this.Text = "VisualStyleInformation Property Values";

			listView1.Bounds = new Rectangle(new Point(10, 10),
				new Size(400, 300));
			listView1.View = View.Details;
			listView1.FullRowSelect = true;
			listView1.Sorting = SortOrder.Ascending;

			Type typeInfo = typeof(VisualStyleInformation);
			StringBuilder name = new StringBuilder();
			object propertyValue;

			// Declare an array of static/Shared property details for the 
			// VisualStyleInformation class.
			PropertyInfo[] elementProperties =
				typeInfo.GetProperties(BindingFlags.Static | BindingFlags.Public);

			// Insert each property name and value into the ListView. 
			foreach (PropertyInfo property in elementProperties)
				propertyValue = property.GetValue(null,
					BindingFlags.Static, null, null, null);
				ListViewItem newItem = new ListViewItem(name.ToString(), 0);
				name.Remove(0, name.Length);

			// Create columns for the items and subitems.
			listView1.Columns.Add("Property", -2, System.Windows.Forms.HorizontalAlignment.Left);
			listView1.Columns.Add("Value", -2, System.Windows.Forms.HorizontalAlignment.Left);

			// Add the ListView to the control collection. 


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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