다음을 통해 공유


VisualStyleState 열거형

정의

비주얼 스타일을 현재 애플리케이션에 적용하는 방법을 지정합니다.

이 열거형은 멤버 값의 비트 조합을 지원합니다.

public enum class VisualStyleState
public enum VisualStyleState
[System.Flags]
public enum VisualStyleState
type VisualStyleState = 
[<System.Flags>]
type VisualStyleState = 
Public Enum VisualStyleState
상속
VisualStyleState
특성

필드

ClientAndNonClientAreasEnabled 3

비주얼 스타일을 클라이언트 및 비클라이언트 영역에 적용합니다.

ClientAreaEnabled 2

비주얼 스타일을 클라이언트 영역에만 적용합니다.

NonClientAreaEnabled 1

비주얼 스타일을 비클라이언트 영역에만 적용합니다.

NoneEnabled 0

비주얼 스타일을 애플리케이션에 적용하지 않습니다.

예제

다음 코드 예제는 각 지정 된 네 가지 영역에서 비주얼 스타일을 적용 하는 간단한 프로그램을 VisualStyleState 값입니다. 특정 부분에서 비주얼 스타일을 사용 하도록 설정 하려면을 사용 하도록 설정 하 고 클릭 하려는 영역을 나타내는 옵션 단추 (라디오 단추 라고도 함)를 클릭 합니다 업데이트 VisualStyleState 창에서 변경 내용을 확인 하는 단추입니다.

#using <System.Drawing.dll>
#using <System.Windows.Forms.dll>
#using <System.dll>

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

namespace VisualStyleStateSample
{
    public ref class VisualStyleStateForm : public Form
    {
        Button^ updateButton;
        RadioButton^ applyToClient;
        RadioButton^ applyToNonClient;
        RadioButton^ applyToAll;
        RadioButton^ disableStyles;

    public:
        VisualStyleStateForm()
        {
            updateButton = gcnew Button();
            applyToClient = gcnew RadioButton();
            applyToNonClient = gcnew RadioButton();
            applyToAll = gcnew RadioButton();
            disableStyles = gcnew RadioButton();

            updateButton->AutoSize = true;
            updateButton->Location = Point(10, 10);
            updateButton->Text = "Update VisualStyleState";
            updateButton->Click += gcnew EventHandler(this, 
                &VisualStyleStateForm::UpdateButton_Click);

            applyToClient->Location = Point(10, 50);
            applyToClient->AutoSize = true;
            applyToClient->Text = "Apply styles to client area only";

            applyToNonClient->Location = Point(10, 70);
            applyToNonClient->AutoSize = true;
            applyToNonClient->Text = "Apply styles to nonclient area only";

            applyToAll->Location = Point(10, 90);
            applyToAll->AutoSize = true;
            applyToAll->Text = "Apply styles to client and nonclient areas";

            disableStyles->Location = Point(10, 110);
            disableStyles->AutoSize = true;
            disableStyles->Text = "Disable styles in all areas";

            this->Text = "VisualStyleState Test";
            this->Controls->AddRange(gcnew array<Control^>{updateButton,
                applyToClient, applyToNonClient, applyToAll, disableStyles});
        }

    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);
        }
    };
}

[STAThread]
int main()
{
    Application::EnableVisualStyles();
    Application::Run(gcnew VisualStyleStateSample::VisualStyleStateForm());
}
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;

namespace VisualStyleStateSample
{
    class Form1 : Form
    {
        Button button1 = new Button();
        RadioButton radioButton1 = new RadioButton();
        RadioButton radioButton2 = new RadioButton();
        RadioButton radioButton3 = new RadioButton();
        RadioButton radioButton4 = new RadioButton();

        public Form1()
        {
            button1.AutoSize = true;
            button1.Location = new Point(10, 10);
            button1.Text = "Update VisualStyleState";
            button1.Click += new EventHandler(button1_Click);

            radioButton1.Location = new Point(10, 50);
            radioButton1.AutoSize = true;
            radioButton1.Text = "Apply styles to client area only";

            radioButton2.Location = new Point(10, 70);
            radioButton2.AutoSize = true;
            radioButton2.Text = "Apply styles to nonclient area only";

            radioButton3.Location = new Point(10, 90);
            radioButton3.AutoSize = true;
            radioButton3.Text = "Apply styles to client and nonclient areas";

            radioButton4.Location = new Point(10, 110);
            radioButton4.AutoSize = true;
            radioButton4.Text = "Disable styles in all areas";

            this.Text = "VisualStyleState Test";
            this.Controls.AddRange(new Control[] { button1,  
                radioButton1, radioButton2, radioButton3, radioButton4});
        }

        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.Run(new Form1());
        }

        void button1_Click(object sender, EventArgs e)
        {
            if (radioButton1.Checked)
            {
                Application.VisualStyleState =
                    VisualStyleState.ClientAreaEnabled;
            }
            else if (radioButton2.Checked)
            {
                Application.VisualStyleState =
                    VisualStyleState.NonClientAreaEnabled;
            }
            else if (radioButton3.Checked)
            {
                Application.VisualStyleState =
                    VisualStyleState.ClientAndNonClientAreasEnabled;
            }
            else if (radioButton4.Checked)
            {
                Application.VisualStyleState =
                    VisualStyleState.NoneEnabled;
            }

            // Repaint the form and all child controls.
            this.Invalidate(true);
        }
    }
}
Imports System.Drawing
Imports System.Windows.Forms
Imports System.Windows.Forms.VisualStyles

Namespace VisualStyleStateSample

    Class Form1
        Inherits Form
        Private WithEvents button1 As New Button()
        Private radioButton1 As New RadioButton()
        Private radioButton2 As New RadioButton()
        Private radioButton3 As New RadioButton()
        Private radioButton4 As New RadioButton()

        Public Sub New()
            With button1
                .AutoSize = True
                .Location = New Point(10, 10)
                .Text = "Update VisualStyleState"
            End With

            With radioButton1
                .Location = New Point(10, 50)
                .AutoSize = True
                .Text = "Apply styles to client area only"
            End With

            With radioButton2
                .Location = New Point(10, 70)
                .AutoSize = True
                .Text = "Apply styles to nonclient area only"
            End With

            With radioButton3
                .Location = New Point(10, 90)
                .AutoSize = True
                .Text = "Apply styles to client and nonclient areas"
            End With

            With radioButton4
                .Location = New Point(10, 110)
                .AutoSize = True
                .Text = "Disable styles in all areas"
            End With

            Me.Text = "VisualStyleState Test"
            Me.Controls.AddRange(New Control() {button1, radioButton1, _
                radioButton2, radioButton3, radioButton4})
        End Sub

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

        Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) _
            Handles button1.Click

            If radioButton1.Checked Then
                Application.VisualStyleState = _
                    VisualStyleState.ClientAreaEnabled
            ElseIf radioButton2.Checked Then
                Application.VisualStyleState = _
                    VisualStyleState.NonClientAreaEnabled
            ElseIf radioButton3.Checked Then
                Application.VisualStyleState = _
                    VisualStyleState.ClientAndNonClientAreasEnabled
            ElseIf radioButton4.Checked Then
                Application.VisualStyleState = _
                    VisualStyleState.NoneEnabled
            End If

            ' Repaint the form and all child controls.
            Me.Invalidate(True)
        End Sub

    End Class
End Namespace

설명

이 열거형은에서 사용 된 Application.VisualStyleState 비주얼 스타일의 애플리케이션 windows 클라이언트 또는 비클라이언트 영역에 적용 되었는지 여부를 지정 하는 속성입니다.

적용 대상