VisualStyleInformation Class
Provides information about the current visual style of the operating system.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
| Name | Description | |
|---|---|---|
![]() ![]() | Author | Gets the author of the current visual style. |
![]() ![]() | ColorScheme | Gets the color scheme of the current visual style. |
![]() ![]() | Company | Gets the company that created the current visual style. |
![]() ![]() | ControlHighlightHot | Gets the color that the current visual style uses to indicate the hot state of a control. |
![]() ![]() | Copyright | Gets the copyright of the current visual style. |
![]() ![]() | Description | Gets a description of the current visual style. |
![]() ![]() | DisplayName | Gets the display name of the current visual style. |
![]() ![]() | IsEnabledByUser | Gets a value indicating whether the user has enabled visual styles in the operating system. |
![]() ![]() | IsSupportedByOS | Gets a value indicating whether the operating system supports visual styles. |
![]() ![]() | MinimumColorDepth | Gets the minimum color depth for the current visual style. |
![]() ![]() | Size | Gets a string that describes the size of the current visual style. |
![]() ![]() | SupportsFlatMenus | Gets a value indicating whether the current visual style supports flat menus. |
![]() ![]() | TextControlBorder | Gets the color that the current visual style uses to paint the borders of controls that contain text. |
![]() ![]() | Url | Gets a URL provided by the author of the current visual style. |
![]() ![]() | Version | 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.
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()); }
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.

