用C#制作电子相册的“添加图片”和“删除图片”的代码
1个回答
2013-11-13
展开全部
删除本地图片
首先获得图片的路径
string address="路径";
FileInfo file = new FileInfo(address);
file.delete();
增加就直接保存图片框里面的图片就OK了
SaveFileDialog fileone = new SaveFileDialog();
fileone.OverwritePrompt = true;
fileone.Filter = "BMP文件|*.bmp|GIF文件|*.gif|JPG文件|*.jpg|PNG文件|*.png|ICO文件|*.ico|所有文件|*.*";
fileone.FilterIndex = 1;
fileone.ShowDialog();
if (fileone.FilterIndex == 1)
{
this.picBox.Image.Save(fileone.FileName, System.Drawing.Imaging.ImageFormat.Bmp);
userHelper.iniSuffix = ".bmp";
}
else if (fileone.FilterIndex == 2)
{
this.picBox.Image.Save(fileone.FileName, System.Drawing.Imaging.ImageFormat.Gif);
userHelper.iniSuffix = ".gif";
}
else if (fileone.FilterIndex == 3)
{
this.picBox.Image.Save(fileone.FileName, System.Drawing.Imaging.ImageFormat.Jpeg);
userHelper.iniSuffix = ".jpg";
}
else if (fileone.FilterIndex == 4)
{
this.picBox.Image.Save(fileone.FileName, System.Drawing.Imaging.ImageFormat.Png);
userHelper.iniSuffix = ".png";
}
else
{
this.picBox.Image.Save(fileone.FileName, System.Drawing.Imaging.ImageFormat.Icon);
userHelper.iniSuffix = ".ico";
}
userHelper.iniAddress = fileone.FileName;
toolStripTextBox1.Text = fileone.FileName;
首先获得图片的路径
string address="路径";
FileInfo file = new FileInfo(address);
file.delete();
增加就直接保存图片框里面的图片就OK了
SaveFileDialog fileone = new SaveFileDialog();
fileone.OverwritePrompt = true;
fileone.Filter = "BMP文件|*.bmp|GIF文件|*.gif|JPG文件|*.jpg|PNG文件|*.png|ICO文件|*.ico|所有文件|*.*";
fileone.FilterIndex = 1;
fileone.ShowDialog();
if (fileone.FilterIndex == 1)
{
this.picBox.Image.Save(fileone.FileName, System.Drawing.Imaging.ImageFormat.Bmp);
userHelper.iniSuffix = ".bmp";
}
else if (fileone.FilterIndex == 2)
{
this.picBox.Image.Save(fileone.FileName, System.Drawing.Imaging.ImageFormat.Gif);
userHelper.iniSuffix = ".gif";
}
else if (fileone.FilterIndex == 3)
{
this.picBox.Image.Save(fileone.FileName, System.Drawing.Imaging.ImageFormat.Jpeg);
userHelper.iniSuffix = ".jpg";
}
else if (fileone.FilterIndex == 4)
{
this.picBox.Image.Save(fileone.FileName, System.Drawing.Imaging.ImageFormat.Png);
userHelper.iniSuffix = ".png";
}
else
{
this.picBox.Image.Save(fileone.FileName, System.Drawing.Imaging.ImageFormat.Icon);
userHelper.iniSuffix = ".ico";
}
userHelper.iniAddress = fileone.FileName;
toolStripTextBox1.Text = fileone.FileName;
博思aippt
2024-07-20 广告
2024-07-20 广告
作为深圳市博思云创科技有限公司的工作人员,对于Word文档生成PPT的操作,我们有以下建议:1. 使用另存为功能:在Word中编辑完文档后,点击文件->另存为,选择PowerPoint演示文稿(*.pptx)格式,即可将文档内容转换为PPT...
点击进入详情页
本回答由博思aippt提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询