日期:2014-05-18 浏览次数:20724 次
public Form1() { InitializeComponent(); pictureBox1.Paint += new PaintEventHandler(pictureBox_Paint); pictureBox2.Paint += new PaintEventHandler(pictureBox_Paint); pictureBox3.Paint += new PaintEventHandler(pictureBox_Paint); } Image img = Image.FromFile(@"C:\Users\SaeWind\Desktop\123\1.png"); void pictureBox_Paint(object sender, PaintEventArgs e) { PictureBox pic = (PictureBox)sender; Graphics g = e.Graphics; g.DrawImage(img, new Rectangle(0, 0, pic.Width, pic.Height)); }
------解决方案--------------------
这样 pictureBox1.Image一直为null
------解决方案--------------------
新手,随便说下:能不能指向同一个栈区呢?