我的应用程序窗口背景中绘制了一个矩形,代码如下:
public Form1()
{
InitializeComponent();
Paint += myDrawingPanel_Paint;
}
private void myDrawingPanel_Paint(object sender, PaintEventArgs e)
{
System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(0, 102, 205));
System.Drawing.Graphics formGraphics;
formGraphics = this.CreateGraphics();
formGraphics.FillRectangle(myBrush, new Rectangle(0, 100, Form1.ActiveForm.Width, Form1.ActiveForm.Height));
myBrush.Dispose();
formGraphics.Dispose();
}