C#中如何打开图片文件
答案:3 悬赏:80 手机版
解决时间 2021-04-02 01:33
- 提问者网友:太高姿态
- 2021-04-01 10:25
C#中如何打开图片文件
最佳答案
- 五星知识达人网友:孤独入客枕
- 2021-04-01 11:58
我暂时保留我的看法!
全部回答
- 1楼网友:独钓一江月
- 2021-04-01 12:44
OpenFileDialog openFile = new OpenFileDialog();
if (openFile.ShowDialog() == DialogResult.OK)
{
string path = openFile.FileName;
Image image = Image.FromFile(path);
this.pictureBox1.Image = image;
}
if (openFile.ShowDialog() == DialogResult.OK)
{
string path = openFile.FileName;
Image image = Image.FromFile(path);
this.pictureBox1.Image = image;
}
- 2楼网友:神鬼未生
- 2021-04-01 12:10
using (OpenFileDialog lvse = new OpenFileDialog())
{
lvse.Title = "选择图片";
lvse.InitialDirectory = "";
lvse.Filter = "图片文件|*.bmp;*.jpg;*.jpeg;*.gif;*.png";
lvse.FilterIndex = 1;
if (lvse.ShowDialog() == DialogResult.OK)
{
pictureBox1.Image = Image.FromFile(lvse.FileName);
}
}
{
lvse.Title = "选择图片";
lvse.InitialDirectory = "";
lvse.Filter = "图片文件|*.bmp;*.jpg;*.jpeg;*.gif;*.png";
lvse.FilterIndex = 1;
if (lvse.ShowDialog() == DialogResult.OK)
{
pictureBox1.Image = Image.FromFile(lvse.FileName);
}
}
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯