实在太菜,一直没解决图像问题,向高手求教!语言C#,现有openFileDialog1,button1,pictureBox1,在解决方案下新建Image.(就是新建在生成文件里)现在单击button1,使pictureBox1显示为openFileDialog1打开的图像,那么我做的结果是:
private void button1_Click(object sender, EventArgs e)
{
this.openFileDialog1.ShowDialog();
if (this.openFileDialog1.FileName.Trim() == "")
{
return;
}
try
{
this.pictureBox1.Image = System.Drawing.Bitmap.FromFile(this.openFileDialog1.FileName
}
catch(Exception exp)
{
MessageBox.Show(this,"打开图片文件错误!","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}那么现在我想使pictureBox1中的图片保存在Image中,如何实现?代码如何?应该还是button1的单击事件,那么请问高手发下代码...
先谢谢了...
private void button1_Click(object sender, EventArgs e)
{
this.openFileDialog1.ShowDialog();
if (this.openFileDialog1.FileName.Trim() == "")
{
return;
}
try
{
this.pictureBox1.Image = System.Drawing.Bitmap.FromFile(this.openFileDialog1.FileName
}
catch(Exception exp)
{
MessageBox.Show(this,"打开图片文件错误!","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}那么现在我想使pictureBox1中的图片保存在Image中,如何实现?代码如何?应该还是button1的单击事件,那么请问高手发下代码...
先谢谢了...
this.pictureBox1.Image.Save(openFileDialog1.FileName);