日期:2014-05-19  浏览次数:21147 次

初学C#画图,为什么不显示图片,请大家帮忙看下!
private   void   Form1_Load(object   sender,   System.EventArgs   e)
{
        Graphics   g=this.pictureBox1.CreateGraphics();
Image   newImage   =   Image.FromFil(@ "E:\UI\VBSrc\RES\Botton\Menu_Focus1.bmp ");
g.DrawImage(newImage,new   Rectangle(500,   500,   newImage.Width,   newImage.Height));
}
我这代码哪里有问题,为什么图片显示不出来,请指点一下,谢谢!

------解决方案--------------------
其实你的图已画过了,只不过在PictureBox显示出来后被系统的重绘给擦掉了.
要保证在系统重绘的时候不被擦掉,就要在Paint事件里画图.