Tag Archives: form background color
Custom form background color
Winforms by default don’t offer much customization as far as coloring, especially when it comes down to gradient patterns.
If you want to change the background of your form to something a bit more unique to make it look like this
then simply follow steps below.
First handle the form’s Paint
event.
1 2 3 4 5 6 7 8 | private void Form1_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; Rectangle rect = new Rectangle(0, 0, this.Size.Width, this.Size.Height); LinearGradientBrush brush = new LinearGradientBrush(rect, Color.Green, Color.White, LinearGradientMode.ForwardDiagonal); g.FillRectangle(brush, rect); brush.Dispose(); } |
Feel free to change the colors and the gradient direction to what you would like.
Posted in C#.
Tagged C#, csharp, custom form background color, form background color, snippet, winforms