您如何在winforms中将图像源设置为图像?

我的图片仅在应用程序的Resources文件夹中

我试过这个

PictureBox pb = new PictureBox();  pb.Image = Image.FromFile(" Resources / a.gif");

但它显示文件未找到异常。

提前致谢

有帮助吗?

解决方案

如果图像在您的应用程序资源中,您可以这样做:

pb.Image = Properties.Resources.a

其他提示

pictureBox1.Image = Properties.Resources.[image name];
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top