Reputation: 245
I want to change the padding color of my windows form how can i do this help me....
this.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3);
Upvotes: 2
Views: 1701
Reputation: 11025
In your form code:
protected override void OnPaintBackground(PaintEventArgs e)
{
//base.OnPaintBackground(e); //comment this out to prevent default painting
using (SolidBrush brush = new SolidBrush(Color.Purple)) //any color you like
e.Graphics.FillRectangle(brush, e.ClipRectangle);
}
Having set your padding, you have exposed the underlying form's background. So just paint it with the color you want to show through.
Upvotes: 1