New gradient background for Button...?
-
Hello, I want to change the gradient background of my button. It's easy to change the background color, but using a custom gradient is obviously less straight forward. Could someone point me in the right direction? Thanks! Ian
-
Hello, I want to change the gradient background of my button. It's easy to change the background color, but using a custom gradient is obviously less straight forward. Could someone point me in the right direction? Thanks! Ian
well, i´d say create a custom control, inherit from button and try something like his in the overridden OnPaint Method
Graphics g = pe.Graphics; //getting graphics object of window background Rectangle bg = new Rectangle(0, 0, this.Width, this.Height); System.Drawing.Drawing2D.LinearGradientBrush brush = new System.Drawing.Drawing2D.LinearGradientBrush(bg, PageStartColor, PageEndColor, 0.0); g.FillRectangle(brush, bg); brush.Dispose();
-
Hello, I want to change the gradient background of my button. It's easy to change the background color, but using a custom gradient is obviously less straight forward. Could someone point me in the right direction? Thanks! Ian
here is code for you !!!!
Bitmap bmp = new Bitmap(500, 500); Graphics G = Graphics.FromImage(bmp); LinearGradientBrush Lb = new LinearGradientBrush(new Point(0, 0), new Point(100, 100), Color.Red, Color.Green); G.FillRectangle(Lb, new Rectangle(0, 0, 100, 100)); button1.BackgroundImage = bmp;
Best Regards ----------------- Abhijit Jana View My Latest Article :- SpyNet : Your Network Spy "Success is Journey it's not a destination"
-
Hello, I want to change the gradient background of my button. It's easy to change the background color, but using a custom gradient is obviously less straight forward. Could someone point me in the right direction? Thanks! Ian
-
well, i´d say create a custom control, inherit from button and try something like his in the overridden OnPaint Method
Graphics g = pe.Graphics; //getting graphics object of window background Rectangle bg = new Rectangle(0, 0, this.Width, this.Height); System.Drawing.Drawing2D.LinearGradientBrush brush = new System.Drawing.Drawing2D.LinearGradientBrush(bg, PageStartColor, PageEndColor, 0.0); g.FillRectangle(brush, bg); brush.Dispose();
Thanks for taking the time! I appreciate it! I'll try this solution.
-
here is code for you !!!!
Bitmap bmp = new Bitmap(500, 500); Graphics G = Graphics.FromImage(bmp); LinearGradientBrush Lb = new LinearGradientBrush(new Point(0, 0), new Point(100, 100), Color.Red, Color.Green); G.FillRectangle(Lb, new Rectangle(0, 0, 100, 100)); button1.BackgroundImage = bmp;
Best Regards ----------------- Abhijit Jana View My Latest Article :- SpyNet : Your Network Spy "Success is Journey it's not a destination"
Thanks for taking the time! I appreciate it! I'll give it a shot.
-
Hi Guy see this link http://www.codeproject.com/KB/buttons/multigradbuttonasp.aspx[^] Thanks
Cheers RRave MCTS,MCPD
Thanks for the link! I'll check it out.