GaGa迷失的.NET

MY .NET

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

using System.Drawing.Imaging;

          
方法1
            string a = "#555555";
            this.button1.BackColor = System.Drawing.Color.FromArgb(0,0,0);
方法2
            this.button1.BackColor =System.Drawing.Color.FromArgb(
                      System.Int16.Parse(a.Substring(1,2),System.Globalization.NumberStyles.AllowHexSpecifier),
                      System.Int16.Parse(a.Substring(3,2),System.Globalization.NumberStyles.AllowHexSpecifier), 
                      System.Int16.Parse(a.Substring(5,2),System.Globalization.NumberStyles.AllowHexSpecifier)
                      );
方法3
            Color   color  = System.Drawing.Color.FromArgb(0xf0,0xf1,0xf2);
            this.button1.BackColor = color;
            System.Drawing.ColorConverter cc = new System.Drawing.ColorConverter();
方法4
               string lbtncolor = "#8E8E8E";
                System.Drawing.ColorConverter cc = new System.Drawing.ColorConverter();
                lbtn.BackColor = (System.Drawing.Color)cc.ConvertFromString(lbtncolor);

posted on 2010-03-22 11:17  为你疯狂  阅读(4609)  评论(0编辑  收藏  举报