本文整理汇总了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);
}
}
}