Application.EnableVisualStyles メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
アプリケーションのビジュアル スタイルを有効にします。
public:
static void EnableVisualStyles();
public static void EnableVisualStyles();
static member EnableVisualStyles : unit -> unit
Public Shared Sub EnableVisualStyles ()
例
次のコード例は、Main関数でEnableVisualStylesを呼び出して、アプリケーションのビジュアル スタイルを有効にする方法を示しています。
#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
注釈
このメソッドは、アプリケーションのビジュアル スタイルを有効にします。 Visual スタイルは、オペレーティング システムのテーマを形成する色、フォント、およびその他のビジュアル要素です。 コントロールとオペレーティング システムでサポートされている場合、コントロールはビジュアル スタイルで描画されます。 効果を得るには、アプリケーションでコントロールを作成する前に EnableVisualStyles() を呼び出す必要があります。通常、 EnableVisualStyles() は Main 関数の最初の行です。
EnableVisualStyles()を呼び出すときに、ビジュアル スタイルを有効にするために別のマニフェストは必要ありません。
Note
このメソッドは、Internet Explorerでホストされているコントロールには影響しません。