Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Application::VisualStyleState Property

 

Gets a value that specifies how visual styles are applied to application windows.

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

public:
property VisualStyleState VisualStyleState {
	static VisualStyleState get();
	static void set(VisualStyleState value);
}

This VisualStyleState property determines whether visual styles are enabled in client areas or nonclient areas of application windows. Generally, this property should be set within the main form's constructor or Load event handler.

The following code example sets the VisualStyleState property to one of the System.Windows.Forms.VisualStyles::VisualStyleState values within the Click event handler for a Button control. This code example is part of a larger example provided for the System.Windows.Forms.VisualStyles::VisualStyleState enumeration.

private:
    void UpdateButton_Click(Object^ sender, EventArgs^ e)
    {
        if (applyToClient->Checked)
        {
            Application::VisualStyleState =
                VisualStyleState::ClientAreaEnabled;
        }
        else if (applyToNonClient->Checked)
        {
            Application::VisualStyleState =
                VisualStyleState::NonClientAreaEnabled;
        }
        else if (applyToAll->Checked)
        {
            Application::VisualStyleState =
                VisualStyleState::ClientAndNonClientAreasEnabled;
        }
        else if (disableStyles->Checked)
        {
            Application::VisualStyleState =
                VisualStyleState::NoneEnabled;
        }

        // Repaint the form and all child controls.
        this->Invalidate(true);
    }

.NET Framework
Available since 2.0
Return to top
Show: