本人初学C#,水平很有限,请批评指正!
C#应用程序启动时:
Application.Run(new Form1());
新建了一个窗体,但是很难在窗体建立后随意改变窗体风格和颜色,本人初学,但经过一番试验发现了如下方法可以在窗体建立后随意改变窗体的风格和颜色。
首先添加一个timer1,下面是timer的代码改变了skinEngine1.SkinFile的属性(kinEngine1是一个改变肤色的扩展控件),注意要把kinEngine1.SkinFile的属性改成你SkinFile所在的绝对路径,SkinFile在附件里面的skin文件夹中。本例中还用到了其他的扩展控件以及本例源码都在附件中。
private void timer1_Tick(object sender, EventArgs e)
{
this.count = this.count + 1;
if (this.count >= 26) { this.count = 0; }
hsttextbox1.Text = (this.count).ToString("#0");
switch (this.count)
{
case 0:
this.skinEngine1.SerialNumber = "";
this.skinEngine1.SkinFile = "C:\\Documents and Settings\\vincent\\My Documents\\Visual Studio 2005\\Projects\\clourfulskin\\clourfulskin\\skin\\Calmness.ssk";
//this.skinEngine1.SkinStreamMain = ((System.IO.Stream)(resources.GetObject("skinEngine1.SkinStreamMain")));
break;
case 1:
//this.Close();
this.skinEngine1.SerialNumber = "";
this.skinEngine1.SkinFile = "C:\\Documents and Settings\\vincent\\My Documents\\Visual Studio 2005\\Projects\\clourfulskin\\clourfulskin\\skin\\CalmnessColor1.ssk";
//this.skinEngine1.SkinStreamMain = ((System.IO.Stream)(resources.GetObject("skinEngine1.SkinStreamMain")));
new Form1();
break;
case 2:
this.skinEngine1.SerialNumber = "";
this.skinEngine1.SkinFile = "C:\\Documents and Settings\\vincent\\My Documents\\Visual Studio 2005\\Projects\\clourfulskin\\clourfulskin\\skin\\CalmnessColor2.ssk";
//this.skinEngine1.SkinStreamMain = ((System.IO.Stream)(resources.GetObject("skinEngine1.SkinStreamMain")));
new Form1();
break;
case 3:
this.skinEngine1.SerialNumber = "";
this.skinEngine1.SkinFile = "C:\\Documents and Settings\\vincent\\My Documents\\Visual Studio 2005\\Projects\\clourfulskin\\clourfulskin\\skin\\DeepCyan.ssk";
//this.skinEngine1.SkinStreamMain = ((System.IO.Stream)(resources.GetObject("skinEngine1.SkinStreamMain")));
new Form1();
break;
case 4:
this.skinEngine1.SerialNumber = "";
this.skinEngine1.SkinFile = "C:\\Documents and Settings\\vincent\\My Documents\\Visual Studio 2005\\Projects\\clourfulskin\\clourfulskin\\skin\\DeepGreen.ssk";
//this.skinEngine1.SkinStreamMain = ((System.IO.Stream)(resources.GetObject("skinEngine1.SkinStreamMain")));
new Form1();
break;
case 5:
this.skinEngine1.SerialNumber = "";
this.skinEngine1.SkinFile = "C:\\Documents and Settings\\vincent\\My Documents\\Visual Studio 2005\\Projects\\clourfulskin\\clourfulskin\\skin\\DeepOrange.ssk";
///this.skinEngine1.SkinStreamMain = ((System.IO.Stream)(resources.GetObject("skinEngine1.SkinStreamMain")));
new Form1();
break;
case 6:
this.skinEngine1.SerialNumber = "";
this.skinEngine1.SkinFile = "C:\\Documents and Settings\\vincent\\My Documents\\Visual Studio 2005\\Projects\\clourfulskin\\clourfulskin\\skin\\DiamondBlue.ssk";
//this.skinEngine1.SkinStreamMain = ((System.IO.Stream)(resources.GetObject("skinEngine1.SkinStreamMain")));
new Form1();
break;
case 7:
this.skinEngine1.SerialNumber = "";
this.skinEngine1.SkinFile = "C:\\Documents and Settings\\vincent\\My Documents\\Visual Studio 2005\\Projects\\clourfulskin\\clourfulskin\\skin\\DiamondGreen.ssk";
//this.skinEngine1.SkinStreamMain = ((System.IO.Stream)(resources.GetObject("skinEngine1.SkinStreamMain")));
new Form1();
break;
case 8:
this.skinEngine1.SerialNumber = "";
&nb