我想改变填充颜色我窗口形式我该怎么办这个帮我的....可以更改或设置Windows窗体的填充颜色吗?
this.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3);
我想改变填充颜色我窗口形式我该怎么办这个帮我的....可以更改或设置Windows窗体的填充颜色吗?
this.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3);
在你的表单代码:
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);
}
将其具有的填充,你已经暴露了底层窗体的背景。所以只需用你想要展示的颜色来画。
谢谢它会真的有帮助.... :-) – Coderz
这不工作,如果窗体是MDI容器...寻找解决方案.. 。 –
覆盖OnPaintBackground()并以任何你喜欢的方式绘制它。 –
@Hans Passant - 我怎么能这样做,你会解释更多.. – Coderz