Windows 窗体上绘制图形 (Visual C#)代码不显示
private void button1_Click(object sender, EventArgs e)
{
Graphics objGraphics = null;
objGraphics = this.CreateGraphics();
objGraphics.Clear(SystemColors.Control);
objGraphics.DrawRectangle(Pens.Blue,
picShowPicture1.Left - 1, picShowPicture1.Top - 1,
picShowPicture1.Width + 1, picShowPicture1.Height + 1);
objGraphics.Dispose();
}
这段代码中objGraphics.DrawRectangle(Pens.Blue,
picShowPicture1.Left - 1, picShowPicture1.Top - 1,
picShowPicture1.Width + 1, picShowPicture1.Height + 1);
是在图片框空件外面绘制一个蓝色的线框,为什么我代码谈加上去却没显示呢?而且也没报代码错误!
求助!!!!!!!