This documentation is archived and is not being maintained.
VisualStyleInformation Class
Visual Studio 2010
Provides information about the current visual style of the operating system.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
The VisualStyleInformation type exposes the following members.
| 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. |
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()); }
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.
Show:
