| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 10358 人关注过本帖, 4 人收藏
标题:原创c#魔幻皮肤变色窗体源码及其控件,饮水思源,报答本论坛无私的c#爱好者 ...
只看楼主 加入收藏
dragondoudou
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2008-10-9
收藏(4)
 问题点数:0 回复次数:36 
原创c#魔幻皮肤变色窗体源码及其控件,饮水思源,报答本论坛无私的c#爱好者及斑竹们
此窗体可以变换26种颜色和风格,控件是从本论坛下载,本人编写了代码,饮水思源,报答本论坛无私的c#爱好者及斑竹们
clourfulskin.rar (512.08 KB) 此窗体可以变换26种颜色和风格,控件是从本论坛下载,本人编写了代码,饮水思源,报答本论坛无私的c#爱好者 ...

收到的鲜花
  • 静夜思2008-10-09 23:56 送鲜花  50朵   附言:精品文章
搜索更多相关主题的帖子: 爱好者 皮肤 源码 控件 窗体 
2008-10-09 22:48
dragondoudou
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2008-10-9
收藏
得分:0 
237325
本人初学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 = (()(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 = (()(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 = (()(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 = (()(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 = (()(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 = (()(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 = (()(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 = (()(resources.GetObject("skinEngine1.SkinStreamMain")));
                    new Form1();
                    break;
                case 8:
                    this.skinEngine1.SerialNumber = "";
                    this.skinEngine1.SkinFile = "C:\\Documents and Settings\\vincent\\My Documents\\Visual Studio 2005\\Projects\\clourfulskin\\clourfulskin\\skin\\Eighteen.ssk";
                    //this.skinEngine1.SkinStreamMain = (()(resources.GetObject("skinEngine1.SkinStreamMain")));
                    new Form1();
                    break;
                case 9:
                    this.skinEngine1.SerialNumber = "";
                    this.skinEngine1.SkinFile = "C:\\Documents and Settings\\vincent\\My Documents\\Visual Studio 2005\\Projects\\clourfulskin\\clourfulskin\\skin\\EighteenColor1.ssk";
                    //this.skinEngine1.SkinStreamMain = (()(resources.GetObject("skinEngine1.SkinStreamMain")));
                    new Form1();
                    break;
                case 10:
                    this.skinEngine1.SerialNumber = "";
                    this.skinEngine1.SkinFile = "C:\\Documents and Settings\\vincent\\My Documents\\Visual Studio 2005\\Projects\\clourfulskin\\clourfulskin\\skin\\EighteenColor2.ssk";
                    //this.skinEngine1.SkinStreamMain = (()(resources.GetObject("skinEngine1.SkinStreamMain")));
                    new Form1();
                    break;
                case 11:
                    this.skinEngine1.SerialNumber = "";
                    this.skinEngine1.SkinFile = "C:\\Documents and Settings\\vincent\\My Documents\\Visual Studio 2005\\Projects\\clourfulskin\\clourfulskin\\skin\\Emerald.ssk";
                    //this.skinEngine1.SkinStreamMain = (()(resources.GetObject("skinEngine1.SkinStreamMain")));
                    new Form1();
                    break;
                case 12:
                    this.skinEngine1.SerialNumber = "";
                    this.skinEngine1.SkinFile = "C:\\Documents and Settings\\vincent\\My Documents\\Visual Studio 2005\\Projects\\clourfulskin\\clourfulskin\\skin\\EmeraldColor1.ssk";
                   // this.skinEngine1.SkinStreamMain = (()(resources.GetObject("skinEngine1.SkinStreamMain")));
                    new Form1();break;
                case 13:
                    this.skinEngine1.SerialNumber = "";
                    this.skinEngine1.SkinFile = "C:\\Documents and Settings\\vincent\\My Documents\\Visual Studio 2005\\Projects\\clourfulskin\\clourfulskin\\skin\\EmeraldColor2.ssk";
                    //this.skinEngine1.SkinStreamMain = (()(resources.GetObject("skinEngine1.SkinStreamMain")));
                    new Form1();break;
                case 14:
                    this.skinEngine1.SerialNumber = "";
                    this.skinEngine1.SkinFile = "C:\\Documents and Settings\\vincent\\My Documents\\Visual Studio 2005\\Projects\\clourfulskin\\clourfulskin\\skin\\EmeraldColor3.ssk";
                    //this.skinEngine1.SkinStreamMain = (()(resources.GetObject("skinEngine1.SkinStreamMain")));
                    new Form1();
                    break;
                case 15:
                    this.skinEngine1.SerialNumber = "";
                    this.skinEngine1.SkinFile = "C:\\Documents and Settings\\vincent\\My Documents\\Visual Studio 2005\\Projects\\clourfulskin\\clourfulskin\\skin\\GlassBrown.ssk";
                    //this.skinEngine1.SkinStreamMain = (()(resources.GetObject("skinEngine1.SkinStreamMain")));
                    new Form1();
                    break;
                case 16:
                    this.skinEngine1.SerialNumber = "";
                    this.skinEngine1.SkinFile = "C:\\Documents and Settings\\vincent\\My Documents\\Visual Studio 2005\\Projects\\clourfulskin\\clourfulskin\\skin\\GlassGreen.ssk";
                    //this.skinEngine1.SkinStreamMain = (()(resources.GetObject("skinEngine1.SkinStreamMain")));
                    new Form1();
                    break;
                case 17:
                    this.skinEngine1.SerialNumber = "";
                    this.skinEngine1.SkinFile = "C:\\Documents and Settings\\vincent\\My Documents\\Visual Studio 2005\\Projects\\clourfulskin\\clourfulskin\\skin\\GlassOrange.ssk";
                    //this.skinEngine1.SkinStreamMain = (()(resources.GetObject("skinEngine1.SkinStreamMain")));
                    new Form1();
                    break;
                case 18:
                    this.skinEngine1.SerialNumber = "";
                    this.skinEngine1.SkinFile = "C:\\Documents and Settings\\vincent\\My Documents\\Visual Studio 2005\\Projects\\clourfulskin\\clourfulskin\\skin\\Longhorn.ssk";
                    //this.skinEngine1.SkinStreamMain = (()(resources.GetObject("skinEngine1.SkinStreamMain")));
                    new Form1();
                    break;
                case 19:
                    this.skinEngine1.SerialNumber = "";
                    this.skinEngine1.SkinFile = "C:\\Documents and Settings\\vincent\\My Documents\\Visual Studio 2005\\Projects\\clourfulskin\\clourfulskin\\skin\\MacOS.ssk";
                    //this.skinEngine1.SkinStreamMain = (()(resources.GetObject("skinEngine1.SkinStreamMain")));
                    new Form1();
                    break;
                case 20:
                    this.skinEngine1.SerialNumber = "";
                    this.skinEngine1.SkinFile = "C:\\Documents and Settings\\vincent\\My Documents\\Visual Studio 2005\\Projects\\clourfulskin\\clourfulskin\\skin\\Midsummer.ssk";
                    //this.skinEngine1.SkinStreamMain = (()(resources.GetObject("skinEngine1.SkinStreamMain")));
                    new Form1();
                    break;
                case 21:
                    this.skinEngine1.SerialNumber = "";
                    this.skinEngine1.SkinFile = "C:\\Documents and Settings\\vincent\\My Documents\\Visual Studio 2005\\Projects\\clourfulskin\\clourfulskin\\skin\\MidsummerColor1.ssk";
                    //this.skinEngine1.SkinStreamMain = (()(resources.GetObject("skinEngine1.SkinStreamMain")));
                    new Form1();
                    break;
                case 22:
                    this.skinEngine1.SerialNumber = "";
                    this.skinEngine1.SkinFile = "C:\\Documents and Settings\\vincent\\My Documents\\Visual Studio 2005\\Projects\\clourfulskin\\clourfulskin\\skin\\MidsummerColor2.ssk";
                    //this.skinEngine1.SkinStreamMain = (()(resources.GetObject("skinEngine1.SkinStreamMain")));
                    new Form1();
                    break;
                case 23:
                    this.skinEngine1.SerialNumber = "";
                    this.skinEngine1.SkinFile = "C:\\Documents and Settings\\vincent\\My Documents\\Visual Studio 2005\\Projects\\clourfulskin\\clourfulskin\\skin\\MidsummerColor3.ssk";
                    //this.skinEngine1.SkinStreamMain = (()(resources.GetObject("skinEngine1.SkinStreamMain")));
                    new Form1();
                    break;
                case 24:
                    this.skinEngine1.SerialNumber = "";
                    this.skinEngine1.SkinFile = "C:\\Documents and Settings\\vincent\\My Documents\\Visual Studio 2005\\Projects\\clourfulskin\\clourfulskin\\skin\\MP10.ssk";
                   // this.skinEngine1.SkinStreamMain = (()(resources.GetObject("skinEngine1.SkinStreamMain")));
                    new Form1();
                    break;
                case 25:
                    this.skinEngine1.SerialNumber = "";
                    this.skinEngine1.SkinFile = "C:\\Documents and Settings\\vincent\\My Documents\\Visual Studio 2005\\Projects\\clourfulskin\\clourfulskin\\skin\\MSN.ssk";
                    //this.skinEngine1.SkinStreamMain = (()(resources.GetObject("skinEngine1.SkinStreamMain")));
                    new Form1();
                    break;
            }
            //InitializeComponent();
        }
到此为止可以改变26种颜色。
欢迎交流!欢迎指正!新的源码修改成了相对路径,用语句@""
clourfulskin.rar (633.03 KB) 一种简单快速改变窗体风格和肤色的方法源码及其控件,饮水思源,报答本论坛无私的c#爱好者及斑竹们



[[it] 本帖最后由 dragondoudou 于 2008-10-11 21:47 编辑 [/it]]
2008-10-10 00:24
skyzoneskyzone
Rank: 1
等 级:新手上路
威 望:1
帖 子:137
专家分:0
注 册:2008-10-6
收藏
得分:0 
哇,好棒,我也是初学者,另:菜菜地问一下:那个路径为什么用两个\即“\\”来表示?
2008-10-10 08:12
小仙
Rank: 7Rank: 7Rank: 7
来 自:光之谷
等 级:贵宾
威 望:39
帖 子:1812
专家分:1
注 册:2008-8-8
收藏
得分:0 
'\'加路径会出现转义符错误,为了避免就'\\'代表'\'了,另外@"\"也可以达到此效果。


仁者乐膳,智者乐睡。我都爱~
2008-10-10 08:38
乖老鼠
Rank: 5Rank: 5
来 自:四川省
等 级:职业侠客
威 望:2
帖 子:434
专家分:394
注 册:2008-9-8
收藏
得分:0 
skinEngine1是第三方控件吧?自己开发小东西还可以,要是企业级的就得花钱买咯
2008-10-10 08:40
dragondoudou
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2008-10-9
收藏
得分:0 
回复 4# 小仙 的帖子
厉害,到位
2008-10-10 19:44
wangbo0239
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2008-10-10
收藏
得分:0 
怎么运行一会 CPU就堵死, 而且很占内存,
2008-10-10 20:26
ruanjian2110
Rank: 3Rank: 3
来 自:武汉
等 级:论坛游民
威 望:7
帖 子:486
专家分:50
注 册:2008-5-25
收藏
得分:0 
楼主这句改成这样岂不是更简单啊,何必搞那么长的路径啊。。。。
this.skinEngine1.SkinFile = Application.ExecutablePath+ "\\MP10.ssk";//所在应用程序的路径,把皮肤放在exe文件所在的目录。。

[[it] 本帖最后由 ruanjian2110 于 2008-10-10 22:54 编辑 [/it]]

武汉信控科技有限公司:http://www. 超越技术,本身就是一个美好技术。。。。。。
2008-10-10 22:39
lipng123
Rank: 1
等 级:新手上路
帖 子:62
专家分:0
注 册:2007-6-28
收藏
得分:0 
不喜欢用皮肤..
   太占资源了

2008-10-11 15:11
duanchangren
Rank: 1
等 级:新手上路
威 望:1
帖 子:252
专家分:0
注 册:2008-7-26
收藏
得分:0 
各人所爱
2008-10-11 16:00
快速回复:原创c#魔幻皮肤变色窗体源码及其控件,饮水思源,报答本论坛无私的c#爱 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.021062 second(s), 11 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved