Application.EnableVisualStyles 메서드

정의

애플리케이션에 비주얼 스타일을 사용합니다.

public:
 static void EnableVisualStyles();
public static void EnableVisualStyles ();
static member EnableVisualStyles : unit -> unit
Public Shared Sub EnableVisualStyles ()

예제

다음 코드 예제에서는 호출 EnableVisualStylesMain 함수 애플리케이션에 대 한 비주얼 스타일을 사용 하도록 설정 합니다.

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

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

namespace VStyles
{
   public ref class Form1: public System::Windows::Forms::Form
   {
   private:
      System::Windows::Forms::Button^ button1;

   public:
      Form1()
      {
         this->button1 = gcnew System::Windows::Forms::Button;
         this->button1->Location = System::Drawing::Point( 24, 16 );
         this->button1->Size = System::Drawing::Size( 120, 100 );
         this->button1->FlatStyle = FlatStyle::System;
         this->button1->Text = "I am themed.";
         
         // Sets up how the form should be displayed and adds the controls to the form.
         this->ClientSize = System::Drawing::Size( 300, 286 );
         this->Controls->Add( this->button1 );
         this->Text = "Application::EnableVisualStyles Example";
      }

   };

}


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

namespace VStyles
{
    public class Form1 : System.Windows.Forms.Form
    {

        private System.Windows.Forms.Button button1;
        
        [STAThread]
        static void Main() 
        {
            Application.EnableVisualStyles();
            Application.Run(new Form1());
        }

        public Form1()
        {
            this.button1 = new System.Windows.Forms.Button();
            this.button1.Location = new System.Drawing.Point(24, 16);
            this.button1.Size = new System.Drawing.Size(120, 100);
            this.button1.FlatStyle = FlatStyle.System;
            this.button1.Text = "I am themed.";

            // Sets up how the form should be displayed and adds the controls to the form.
            this.ClientSize = new System.Drawing.Size(300, 286);
            this.Controls.Add(this.button1);

            this.Text = "Application.EnableVisualStyles Example";
        }
    }
}
Imports System.Drawing
Imports System.Windows.Forms

Namespace VStyles
    
    ' Summary description for Form1.
    Public Class Form1
        Inherits System.Windows.Forms.Form

        Private button1 As System.Windows.Forms.Button

        <System.STAThread()> _
        Public Shared Sub Main()

            System.Windows.Forms.Application.EnableVisualStyles()
            System.Windows.Forms.Application.Run(New Form1)
        End Sub

        Public Sub New()

            Me.button1 = New System.Windows.Forms.Button()
            Me.button1.Location = New System.Drawing.Point(24, 16)
            Me.button1.Size = New System.Drawing.Size(120, 100)
            Me.button1.FlatStyle = FlatStyle.System
            Me.button1.Text = "I am themed."

            ' Sets up how the form should be displayed and adds the controls to the form.
            Me.ClientSize = New System.Drawing.Size(300, 286)
            Me.Controls.Add(Me.button1)

            Me.Text = "Application.EnableVisualStyles Example"
        End Sub

    End Class
End Namespace 'VStyles

설명

이 메서드는 애플리케이션에 대 한 비주얼 스타일을 사용 합니다. 비주얼 스타일은 운영 체제 테마를 형성하는 색, 글꼴 및 기타 시각적 요소입니다. 컨트롤과 운영 체제가 지원하는 경우 컨트롤은 비주얼 스타일로 그립니다. 스타일이 적용 되려면 EnableVisualStyles() 애플리케이션에서 컨트롤을 만들기 전에 호출 해야 합니다 일반적으로 EnableVisualStyles() 첫 번째 줄은는 Main 함수입니다. 를 호출 EnableVisualStyles()할 때 비주얼 스타일을 사용하도록 설정하려면 별도의 매니페스트가 필요하지 않습니다.

참고

이 메서드는 인터넷 Explorer 호스트되는 컨트롤에는 영향을 주지 않습니다.

적용 대상

추가 정보