




已閱讀5頁(yè),還剩3頁(yè)未讀, 繼續(xù)免費(fèi)閱讀
版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
c#下重寫(xiě)B(tài)UTTON控件XPButton.cs代碼using System;using System.Windows;using System.Drawing;using System.Drawing.Drawing2D;using System.Windows .Forms ;namespace XPCtrl/ / XPButton 的摘要說(shuō)明。/ public class XPButton:System.Windows.Forms.Buttonprivate bool mouseover=false;public XPButton()/ TODO: 在此處添加構(gòu)造函數(shù)邏輯/this.Cursor = System.Windows.Forms.Cursors.Hand;protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)/base.OnPaint (e);/System.Drawing.Graphics pp=this.CreateGraphics();/e.Graphics.Clear(Color.Transparent);/e.Graphics.DrawEllipse(new System.Drawing.Pen(System.Drawing.Color.WhiteSmoke,5),0,0,this.Width,this.Height);/System.Drawing.SolidBrush dd=new SolidBrush(System.Drawing.Color.WhiteSmoke);/e.Graphics.FillEllipse(dd,0,0,this.Width,this.Height);/ (this.BackColor.ToString ()Color c5 = Color.FromArgb(255,255,255);Color c2 = Color.FromArgb(192,192,192);if(mouseover)c5=Color.FromArgb(245,245,245);/c2=Color.FromArgb(192,192,192);c2=Color.FromArgb(180,175,190);Brush b = new System.Drawing.Drawing2D.LinearGradientBrush(ClientRectangle, c5, c2, LinearGradientMode.Vertical);/System.Drawing.Region=new Region(int offsetwidth=this.Width/50;Point points=new Point8;points0.X=offsetwidth;points0.Y=0;points1.X=this.Width-offsetwidth;points1.Y=0;points2.X=this.Width;points2.Y=offsetwidth;points3.X=this.Width;points3.Y=this.Height-offsetwidth;points4.X=this.Width-offsetwidth;points4.Y=this.Height;points5.X=offsetwidth;points5.Y=this.Height;points6.X=0;points6.Y=this.Height-offsetwidth;points7.X=0;points7.Y=offsetwidth;/e.Graphics.FillRectangle (b, ClientRectangle);e.Graphics.FillPolygon(b,points,FillMode.Winding);if(this.Focused)int offsetwidth1=(this.Width-5)/50+2;Point points1=new Point8;points10.X=offsetwidth1;points10.Y=2;points11.X=this.Width-offsetwidth1;points11.Y=2;points12.X=this.Width-1;points12.Y=offsetwidth1;points13.X=this.Width-1;points13.Y=this.Height-offsetwidth1;points14.X=this.Width-offsetwidth1;points14.Y=this.Height-1;points15.X=1;points15.Y=this.Height-1;points16.X=2;points16.Y=this.Height-offsetwidth1;points17.X=2;points17.Y=offsetwidth1;/e.Graphics.DrawPolygon(new Pen(Color.Yellow,2),points1);Pen p=new Pen(Color.Orange,2);Pen p1=new Pen(Color.Wheat,2);/p.DashStyle=DashStyle.DashDot;e.Graphics.DrawLine(p1,points10,points11);e.Graphics.DrawLine(p,points11,points12);e.Graphics.DrawLine(p,points12,points13);e.Graphics.DrawLine(p,points13,points14);e.Graphics.DrawLine(p,points14,points15);e.Graphics.DrawLine(p,points15,points16);e.Graphics.DrawLine(p1,points16,points17);e.Graphics.DrawLine(p1,points17,points10);e.Graphics.DrawPolygon(new Pen(Color.DarkBlue,2),points);/e.Graphics.DrawLine(new Pen(Color.DarkBlue,2),new Point(0,0),new Point(this.Width,0);/e.Graphics.DrawLine(new Pen(Color.DarkBlue,2),new Point(0,0),new Point(0,this.Height);/e.Graphics.DrawLine(new Pen(Color.DarkBlue,2),new Point(this.Width,this.Height),new Point(this.Width,0);/e.Graphics.DrawLine(new Pen(Color.DarkBlue,2),new Point(this.Width,this.Height),new Point(0,this.Height);StringFormat drawFormat = new StringFormat();drawFormat.FormatFlags = StringFormatFlags.DisplayFormatControl;drawFormat.LineAlignment=StringAlignment.Center;drawFormat.Alignment=System.Drawing.StringAlignment.Center;e.Graphics.DrawString(this.Text,this.Font,new LinearGradientBrush(this.ClientRectangle,Color.Black,Color.Black,LinearGradientMode.Vertical),this.ClientRectangle,drawFormat);b.Dispose();protected override void OnLeave(EventArgs e)base.OnLeave (e);/protected override void OnMouseHover(EventArgs e)/mouseover=true;/this.Invalidate(false);/base.OnMouseHover (e);/protected override void OnMouseEnter(EventArgs e)mouseover=true;this.Invalidate(false);base.OnMouseEnter (e);protected override void OnNotifyMessage(System.Windows.Forms.Message m)base.OnNotifyMessage (m);protected override void OnMouseLeave(EventArgs e)mouseover=false;this.Invalidate(false);base.OnMouseLeave (e);private void DrawButton( System.Drawing.Graphics g)protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs pevent)/Color c5 = Color.FromArgb/(255,255,255);/Color c2 = Color.FromArgb/(192,192,192);/if(mouseover)/c5=Color.FromArgb(245,245,245);/c2=Color.FromArgb(192,192,192);/c2=Color.FromArgb(180,175,190);/Brush b = new System.Drawing.Drawing2D.LinearGradientBrush/(ClientRectangle, c5, c2, LinearGradientMode.Vertical);/pevent.Graphics .DrawRectangle(new Pen(Color.Transparent,2),this.C
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 酒店產(chǎn)權(quán)歸屬協(xié)議書(shū)
- 茶地種植合同協(xié)議書(shū)
- 配合申報(bào)工傷協(xié)議書(shū)
- 人工費(fèi)調(diào)整補(bǔ)充協(xié)議書(shū)
- 辦公室家具供貨協(xié)議書(shū)
- 鄰居舊房拆建協(xié)議書(shū)
- 集體商鋪轉(zhuǎn)讓協(xié)議書(shū)
- 進(jìn)京車(chē)輛租賃協(xié)議書(shū)
- 菜鳥(niǎo)驛站合伙協(xié)議書(shū)
- 餐飲海鮮合作協(xié)議書(shū)
- 八下歷史期中考試試卷分析
- GRR表格MSA第四版完整版
- 京滬高速公路施工組織設(shè)計(jì)
- 陜西全過(guò)程工程咨詢(xún)服務(wù)合同示范文本
- 公路水運(yùn)工程施工企業(yè)(主要負(fù)責(zé)人和安全生產(chǎn)管理人員)考核大綱及模擬題庫(kù)
- 1KV送配電調(diào)試報(bào)告
- GB/T 5801-2020滾動(dòng)軸承機(jī)制套圈滾針軸承外形尺寸、產(chǎn)品幾何技術(shù)規(guī)范(GPS)和公差值
- FZ/T 93029-2016塑料粗紗筒管
- 2022年12月山東省普通高中學(xué)業(yè)水平合格性考試語(yǔ)文仿真模擬試卷C(答題卡)
- 塑膠原料來(lái)料檢驗(yàn)指導(dǎo)書(shū)
- 人教版音樂(lè)三年級(jí)下冊(cè)知識(shí)總結(jié)
評(píng)論
0/150
提交評(píng)論