C#如何保存图片框内的图片?
2个回答
展开全部
//保存
private void btnSave_Click(object sender, EventArgs e)
{
FileInfo fi = new FileInfo(strFileName);
if (fi.Exists)
{
fi.Delete();
this.pictureBox1.Image.Save(strFileName);
}
else
{
this.pictureBox1.Image.Save(strFileName);
}
}
//另存为
private void button1_Click(object sender, EventArgs e)
{
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.Filter = "jpg图片(*.jpg)|*.jpg";
saveFileDialog1.FilterIndex = 2;
saveFileDialog1.RestoreDirectory = true;
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
this.pictureBox1.Image.Save(saveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Jpeg);
}
}
private void btnSave_Click(object sender, EventArgs e)
{
FileInfo fi = new FileInfo(strFileName);
if (fi.Exists)
{
fi.Delete();
this.pictureBox1.Image.Save(strFileName);
}
else
{
this.pictureBox1.Image.Save(strFileName);
}
}
//另存为
private void button1_Click(object sender, EventArgs e)
{
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.Filter = "jpg图片(*.jpg)|*.jpg";
saveFileDialog1.FilterIndex = 2;
saveFileDialog1.RestoreDirectory = true;
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
this.pictureBox1.Image.Save(saveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Jpeg);
}
}
更多追问追答
追问
什么原因啊?
追答
我的怎么没有问题啊!!!!!!!!
展开全部
SaveFileDialog sdf = new SaveFileDialog();
if (sdf.ShowDialog() == DialogResult.OK)
{
Image img = pictureBox1.Image;
img.Save(sdf.FileName);
}
if (sdf.ShowDialog() == DialogResult.OK)
{
Image img = pictureBox1.Image;
img.Save(sdf.FileName);
}
更多追问追答
追问
你看下吧,什么原因啊?
追答
我的合适呀、怎么会不合适、发你邮箱,我邮给你
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询