Using this function you can change the form backcolor to Gradient color.
private void PaintGradientColor(Color color1, Color color2, System.Drawing.Drawing2D.LinearGradientMode mode) { System.Drawing.Drawing2D.LinearGradientBrush a = new System.Drawing.Drawing2D.LinearGradientBrush(new RectangleF(0, 0, this.Width, this.Height), color1, color2, mode); Graphics frmGraphics = this.CreateGraphics(); frmGraphics.FillRectangle(a, new RectangleF(0, 0, this.Width, this.Height)); frmGraphics.Dispose(); }
use this funcion inside Form_paint
private void Form1_Paint(object sender, PaintEventArgs e) { PaintGradientColor(Color.Blue, Color.Firebrick, System.Drawing.Drawing2D.LinearGradientMode.Horizontal);
}
|
No responses found. Be the first to respond and make money from revenue sharing program.
|