本文整理匯總了C#中System.Windows.Forms.VisualStyles.VisualStyleState枚舉的典型用法代碼示例。如果您正苦於以下問題:C# VisualStyleState枚舉的具體用法?C# VisualStyleState怎麽用?C# VisualStyleState使用的例子?那麽, 這裏精選的枚舉代碼示例或許可以為您提供幫助。
在下文中一共展示了VisualStyleState枚舉的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Button
//引入命名空間
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);
}
}
}