C#仿QQ皮肤-常用用户控件EnterFrom1和窗体EntryForm的实现
?????
導(dǎo)讀部分
-------------------------------------------------------------------------------------------------------------
C#仿QQ皮膚-實(shí)現(xiàn)原理系列文章導(dǎo)航 最新版源碼下載
http://www.cckan.net/thread-2-1-1.html
本次是我們窗體實(shí)現(xiàn)的最后一節(jié),在這里首先感謝大家的支持,今天所說一個(gè)用戶控件EnterFrom1和窗體EntryForm其實(shí)是分別繼承自??基窗體FormBase與基用戶控件FormBase1 而來的,而其中EnterFrom1是繼承的用戶控件EnterUserControl? 這個(gè)控件而來,而EnterUserControl? 又是繼承的Formbase1而得來的,具體關(guān)于這個(gè)控件和窗體的實(shí)現(xiàn)請(qǐng)大家參考 相關(guān)的章節(jié),而我們今天 要實(shí)現(xiàn)的兩個(gè)小東東,其實(shí)是最簡(jiǎn)單, 因?yàn)樵贑S類里只要一行代碼就OK了
實(shí)現(xiàn)的效果如下
EnterFrom1
public?partial?class?EnterFrom1?:?EnterUserControl?????{
????????public?EnterFrom1()
????????{
????????????InitializeComponent();
????????}
????}
?
關(guān)鍵的代碼就是第一行,繼承一下EnterUserControl?
這個(gè)用戶控件就行了,而在InitializeComponent()方法中簡(jiǎn)單的數(shù)行代碼就可以完全搞定了
?
代碼 ///?<summary>?????????///?設(shè)計(jì)器支持所需的方法?-?不要
????????///?使用代碼編輯器修改此方法的內(nèi)容。
????????///?</summary>
????????private?void?InitializeComponent()
????????{
????????????System.ComponentModel.ComponentResourceManager?resources?=?new?System.ComponentModel.ComponentResourceManager(typeof(EnterFrom1));
????????????this.SuspendLayout();
????????????//?
????????????//?pnlBackGroup
????????????//?
????????????this.pnlBackGroup.BackgroundImage?=?((System.Drawing.Image)(resources.GetObject("pnlBackGroup.BackgroundImage")));
????????????this.pnlBackGroup.Size?=?new?System.Drawing.Size(723,?496);
????????????//?
????????????//?EnterFrom1
????????????//?
????????????this.AutoScaleDimensions?=?new?System.Drawing.SizeF(6F,?12F);
????????????this.AutoScaleMode?=?System.Windows.Forms.AutoScaleMode.Font;
????????????this.Controls.Add(this.pnlBackGroup);
????????????this.Name?=?"EnterFrom1";
????????????this.Size?=?new?System.Drawing.Size(723,?496);
????????????this.Controls.SetChildIndex(this.pnlBackGroup,?0);
????????????this.ResumeLayout(false);
????????}
?
?
再來看一下EntryForm的實(shí)現(xiàn) 吧,CS類
?
?public?partial?class?EntryForm?:?FunctionFormBase????????{
????????public?EntryForm()
????????{
????????????InitializeComponent();
????????}
????}
?
它的InitializeComponent()方法代碼如下
?
代碼 ///?<summary>????????///?Required?method?for?Designer?support?-?do?not?modify
????????///?the?contents?of?this?method?with?the?code?editor.
????????///?</summary>
????????private?void?InitializeComponent()
????????{
????????????System.ComponentModel.ComponentResourceManager?resources?=?new?System.ComponentModel.ComponentResourceManager(typeof(EntryForm));
????????????this.SuspendLayout();
????????????//?
????????????//?ptbBottomMiddle
????????????//?
????????????this.ptbBottomMiddle.BackgroundImage?=?((System.Drawing.Image)(resources.GetObject("ptbBottomMiddle.BackgroundImage")));
????????????this.ptbBottomMiddle.Size?=?new?System.Drawing.Size(951,?37);
????????????//?
????????????//?pnlBackGroup
????????????//?
????????????this.pnlBackGroup.BackgroundImage?=?((System.Drawing.Image)(resources.GetObject("pnlBackGroup.BackgroundImage")));
????????????this.pnlBackGroup.Location?=?new?System.Drawing.Point(2,?31);
????????????this.pnlBackGroup.Size?=?new?System.Drawing.Size(967,?430);
????????????//?
????????????//?EntryForm
????????????//?
????????????this.AutoScaleDimensions?=?new?System.Drawing.SizeF(6F,?12F);
????????????this.AutoScaleMode?=?System.Windows.Forms.AutoScaleMode.Font;
????????????this.ClientSize?=?new?System.Drawing.Size(971,?498);
????????????this.Controls.Add(this.pnlBackGroup);
????????????this.Location?=?new?System.Drawing.Point(400,?300);
????????????this.Name?=?"EntryForm";
????????????this.Text?=?"EntryForm";
????????????this.Controls.SetChildIndex(this.pnlBackGroup,?0);
????????????this.ResumeLayout(false);
????????}
?
其實(shí)說白了這兩個(gè)東西是一個(gè)實(shí)現(xiàn)原理不同只是一個(gè)是窗體,一個(gè)是用戶控件 而已,其它的差不是很大,相信以后他們兩個(gè)是用的最多的窗體和用戶控件 ,只要大家使用一定會(huì)慢慢的深入了解它們的。
我們實(shí)現(xiàn)原理這一塊的就到這里了,下次就要到我們的框架的搭建了,呵呵,在這一塊才是皮膚的核心東西,講的是怎么樣實(shí)現(xiàn)顏色,就是皮膚的轉(zhuǎn)換,和使用,他們是用什么樣的方式來實(shí)現(xiàn) 的,在寫的過程中我會(huì)一節(jié)一節(jié)的分析一下是怎么樣實(shí)現(xiàn)的,我們都用到了那些GDI+方面的東西,用到了那些方面的Windows消息,和顏色和坐標(biāo)的一些算法等等。
?
轉(zhuǎn)載于:https://www.cnblogs.com/sufei/archive/2010/06/22/1762513.html
總結(jié)
以上是生活随笔為你收集整理的C#仿QQ皮肤-常用用户控件EnterFrom1和窗体EntryForm的实现的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Discrete Log Algorit
- 下一篇: WebService C#开发/调用