简体   繁体   中英

Programmatically set the image of a panel to a jpg file that is not in resources?

How can I programmatically set the image of a panel to a jpg file (a non BMP), that is not in resources?

I know how to set it to a BMP file(not in resources) or a resource file, but how to set it to a JPG file (not in resources)?

您可以使用Image.FromFileImage.FromStream加载图像,然后将其设置为面板的背景图像:

this.panel1.BackgroundImage = Image.FromFile(@"d:\image.jpg");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM