要使用XP的样式,你可以这样来实现: 1.在Main 函数的第一行使用EnableVisualStyles方法。 例如: static void Main() { Application.EnableVisualStyles(); Application.Run(new Form1()); } 2.对于支持 FlatStyle 属性的控件,请确保将 FlatStyle 属性设置为 System 注:此方法适用于Windows XP Home Edition、Windows XP Professional 和 Windows Server 2003
可以用图标呀!比如Button的Image属性,如果Graphics运用的好可以自己画。 class CustomButton:System.Windows.Forms.Control { public override OnPaint(PaintEventArgs e) { //画一个宽200,高200的按钮 Rectangle rect = new Rectangle(0,0,200,100); Brush blackBrush = new SolidBrush(Color.Blue); Graphics g = e.Graphics; g.FillEillpse(blackBrush,rect);
1.在Main 函数的第一行使用EnableVisualStyles方法。
例如:
static void Main()
{
Application.EnableVisualStyles();
Application.Run(new Form1());
}
2.对于支持 FlatStyle 属性的控件,请确保将 FlatStyle 属性设置为 System
注:此方法适用于Windows XP Home Edition、Windows XP Professional 和 Windows Server 2003
class CustomButton:System.Windows.Forms.Control
{
public override OnPaint(PaintEventArgs e)
{
//画一个宽200,高200的按钮
Rectangle rect = new Rectangle(0,0,200,100);
Brush blackBrush = new SolidBrush(Color.Blue);
Graphics g = e.Graphics;
g.FillEillpse(blackBrush,rect);
}
}
在执行文件相同目录中加入一个yourApplicationName.exe.manifest的XML文件,文件内容如下(加下划线片为需进行适当改变):
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="CompanyName.ProductName.YourApp"
type="win32"
/>
Your application description here.
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
http://www.chinacs.net/archives/8/2004/11/29/3128.html