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)

System.Object
  System.Windows.Forms.VisualStyles.VisualStyleInformation

Public NotInheritable Class VisualStyleInformation

NameDescription
System_CAPS_pubpropertySystem_CAPS_staticAuthor

Gets the author of the current visual style.

System_CAPS_pubpropertySystem_CAPS_staticColorScheme

Gets the color scheme of the current visual style.

System_CAPS_pubpropertySystem_CAPS_staticCompany

Gets the company that created the current visual style.

System_CAPS_pubpropertySystem_CAPS_staticControlHighlightHot

Gets the color that the current visual style uses to indicate the hot state of a control.

System_CAPS_pubpropertySystem_CAPS_staticCopyright

Gets the copyright of the current visual style.

System_CAPS_pubpropertySystem_CAPS_staticDescription

Gets a description of the current visual style.

System_CAPS_pubpropertySystem_CAPS_staticDisplayName

Gets the display name of the current visual style.

System_CAPS_pubpropertySystem_CAPS_staticIsEnabledByUser

Gets a value indicating whether the user has enabled visual styles in the operating system.

System_CAPS_pubpropertySystem_CAPS_staticIsSupportedByOS

Gets a value indicating whether the operating system supports visual styles.

System_CAPS_pubpropertySystem_CAPS_staticMinimumColorDepth

Gets the minimum color depth for the current visual style.

System_CAPS_pubpropertySystem_CAPS_staticSize

Gets a string that describes the size of the current visual style.

System_CAPS_pubpropertySystem_CAPS_staticSupportsFlatMenus

Gets a value indicating whether the current visual style supports flat menus.

System_CAPS_pubpropertySystem_CAPS_staticTextControlBorder

Gets the color that the current visual style uses to paint the borders of controls that contain text.

System_CAPS_pubpropertySystem_CAPS_staticUrl

Gets a URL provided by the author of the current visual style.

System_CAPS_pubpropertySystem_CAPS_staticVersion

Gets the version of the current visual style.

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

WinXpFamily

Visual styles are supported only on these platforms.

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

Imports System
Imports System.Drawing
Imports System.Text
Imports System.Reflection
Imports System.Windows.Forms
Imports System.Windows.Forms.VisualStyles

Namespace VisualStyleInformationSample

    Public Class Form1
        Inherits Form
        Private listView1 As New ListView()

        <STAThread()> _
        Shared Sub Main()
            Application.EnableVisualStyles()
            Application.Run(New Form1())
        End Sub

        Public Sub New()
            Me.Text = "VisualStyleInformation Property Values"
            Me.AutoSize = True

            With listView1
                .Bounds = New Rectangle(New Point(10, 10), New Size(400, 300))
                .View = View.Details
                .Sorting = SortOrder.Ascending
            End With

            ' Get an array of property details for the
            ' VisualStyleInformation class.
            Dim typeInfo As Type = GetType(VisualStyleInformation)
            Dim elementProperties As PropertyInfo() = _
                typeInfo.GetProperties(BindingFlags.Static Or BindingFlags.Public)

            ' Use these variables to store the name and value of each property.
            Dim propertyName As New StringBuilder()
            Dim propertyValue As Object
            Dim prop As PropertyInfo

            For Each prop In elementProperties
                ' Get the name and value of the current property.
                propertyName.Append(prop.Name)
                propertyValue = prop.GetValue(Nothing, BindingFlags.Static, _
                    Nothing, Nothing, Nothing)
                ' Insert the property name and value into the ListView.
                Dim newItem As New ListViewItem(propertyName.ToString(), 0)
                newItem.SubItems.Add(propertyValue.ToString())
                listView1.Items.Add(newItem)
                ' Clear the property name for the next iteration.
                propertyName.Remove(0, propertyName.Length)
            Next prop

            ' Create columns for the items and subitems.
            listView1.Columns.Add("Property", -1, _
                System.Windows.Forms.HorizontalAlignment.Left)
            listView1.Columns.Add("Value", -1, _
                System.Windows.Forms.HorizontalAlignment.Left)
            Me.Controls.Add(listView1)
        End Sub
    End Class
End Namespace

.NET Framework
Available since 2.0

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

Return to top
Show: