類似iPhone的 按鈕 上帶數字 winform 按鈕C# 模仿360安全衛士玻璃按鈕(源碼)

來源:互聯網
上載者:User

效果:

因為工作中要用到  類似的代碼       google 了 半天也沒找到,  最後  還是 找到了   園中的  這一篇

C# 模仿360安全衛士玻璃按鈕(源碼)

因為本人水平有限, 但又急著用   所以  胡亂加了一點 代碼  勉強實現了  類似的效果          另外 感謝 原作者(阿東東)提供的 源碼 

 

其它部分基本都沒有修改  主要是在   void DrawImage(Graphics g) 這個 代碼中添加了  畫圓角矩形和數字 效果

              if (BitmapNum > 0)                {                    int x = this.Width - 26;                    int x1 = this.Width - 21;                    int width = 20;                    switch (BitmapNum.ToString().Length)                    {                        case 2:                            x = x + 2;                            width = width + 4;                            break;                        case 3:                            x = x - 4;                            x1 = x + 3;                            width = width + 10;                            break;                        case 4:                            x = x - 8;                            x1 = x + 1;                            width = width + 16;                            break;                    }                    FillRoundRectangle(g, new Rectangle(x, 2, width, 20), BitmapColor, 6);                    g.DrawString(BitmapNum.ToString(), new Font("Arial", 9, FontStyle.Bold),                        new SolidBrush(Color.White), x1, 4);                }

代碼寫的比較爛,  大家湊合看吧    主要也是想  看看  大家有沒有別的更好的方法  能提供一下給我    謝謝了

代碼 不清晰的地方  大家可以對比看看  原作者的代碼  他的比較清楚    

 

源碼: 

 /Files/hpze2000/GlassButton.zip

 

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.