This documentation is archived and is not being maintained.

VisualStyleInformation Class

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

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

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

public ref class VisualStyleInformation abstract sealed

The VisualStyleInformation type exposes the following members.

  NameDescription
Public propertyStatic memberAuthorGets the author of the current visual style.
Public propertyStatic memberColorSchemeGets the color scheme of the current visual style.
Public propertyStatic memberCompanyGets the company that created the current visual style.
Public propertyStatic memberControlHighlightHotGets the color that the current visual style uses to indicate the hot state of a control.
Public propertyStatic memberCopyrightGets the copyright of the current visual style.
Public propertyStatic memberDescriptionGets a description of the current visual style.
Public propertyStatic memberDisplayNameGets the display name of the current visual style.
Public propertyStatic memberIsEnabledByUserGets a value indicating whether the user has enabled visual styles in the operating system.
Public propertyStatic memberIsSupportedByOSGets a value indicating whether the operating system supports visual styles.
Public propertyStatic memberMinimumColorDepthGets the minimum color depth for the current visual style.
Public propertyStatic memberSizeGets a string that describes the size of the current visual style.
Public propertyStatic memberSupportsFlatMenusGets a value indicating whether the current visual style supports flat menus.
Public propertyStatic memberTextControlBorderGets the color that the current visual style uses to paint the borders of controls that contain text.
Public propertyStatic memberUrlGets a URL provided by the author of the current visual style.
Public propertyStatic memberVersionGets the version of the current visual style.
Top

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.Drawing.dll>
#using <System.Windows.Forms.dll>
#using <System.dll>

using namespace System;
using namespace System::Drawing;
using namespace System::Text;
using namespace System::Reflection;
using namespace System::Windows::Forms;
using namespace System::Windows::Forms::VisualStyles;

namespace VisualStyleInformationSample
{
    public ref class StyleInfo : public Form
    {
    private:
        ListView^ displayStyleInfo;

    public:
        StyleInfo()
        {
            this->displayStyleInfo = gcnew ListView();
            this->ClientSize = System::Drawing::Size(500, 500);
            this->Text = "VisualStyleInformation Property Values";

            displayStyleInfo->Bounds = System::Drawing::Rectangle
                (System::Drawing::Point(10, 10),System::Drawing::Size(400, 300));
            displayStyleInfo->View = View::Details;
            displayStyleInfo->FullRowSelect = true;
            displayStyleInfo->Sorting = SortOrder::Ascending;

            Type^ typeInfo = VisualStyleInformation::typeid;
            Object^ propertyValue;

            // Declare an array of static/Shared property details for the
            // VisualStyleInformation class.
            array<PropertyInfo^>^ elementProperties = typeInfo->GetProperties
                (BindingFlags::Static | BindingFlags::Public);

            String^ name;
            // Insert each property name and value into the ListView.
            for each (PropertyInfo^ property in elementProperties)
            {
                name = property->Name;
                propertyValue = property->GetValue(nullptr,
                    BindingFlags::Static, nullptr, nullptr, nullptr);
                ListViewItem^ newItem = gcnew ListViewItem(name, 0);
                newItem->SubItems->Add(propertyValue->ToString());
                displayStyleInfo->Items->Add(newItem);
            }

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

            // Add the ListView to the control collection.
            this->Controls->Add(displayStyleInfo);
        }
    };
}

int main()
{
    Application::EnableVisualStyles();
    Application::Run(gcnew VisualStyleInformationSample::StyleInfo());
}


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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

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