C# picturebox显示位图
时间: 2024-02-17 17:57:40 浏览: 221
vc 如何显示位图 图片的显示
4星 · 用户满意度95%
以下是C#中使用PictureBox显示位图的两种方法:
1. 从文件中加载位图并显示在PictureBox中:
```csharp
string path = Application.StartupPath + @"\GetFile\test.bmp";
Image image = Image.FromFile(path);pictureBox1.Image = image;
```
2. 从资源中加载位图并显示在PictureBox中:
```csharp
private System.Drawing.Bitmap GetResourceBitmap(string strImageName) {
object obj = Properties.Resources.ResourceManager.GetObject(strImageName, Properties.Resources.Culture);
return ((System.Drawing.Bitmap)(obj));
}
```
阅读全文