图像源winforms

Nag*_*agu 4 c# imagesource winforms

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

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

我试过这样的

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

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

提前致谢

Tho*_*que 12

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

pb.Image = Properties.Resources.a
Run Code Online (Sandbox Code Playgroud)