如何使用ImageEdit cotrol将图像地址存储在文件夹中 [英] how to store image address in a folder using ImageEdit cotrol
本文介绍了如何使用ImageEdit cotrol将图像地址存储在文件夹中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在研究winForm并希望将产品图像保存在数据库中。我怎样才能做到这一点?我添加了我已经添加了
1.开发快照pictureEdit控制
2.一个带文本的按钮浏览下面的代码
i am working on winForm and want to save product image in database. How can i do this? i have added I have added
1. dev express pictureEdit control
2. A button with Text Browse with follwing code
using (OpenFileDialog dlg = new OpenFileDialog())
{
dlg.Title = "Open Image";
dlg.Filter = "All Files|*.*";
if (dlg.ShowDialog() == DialogResult.OK)
{
//PictureBox Picture = new PictureBox();
pictureEdit1.Image = new Bitmap(dlg.FileName);
}
3. savedialog box
4.打开对话框
我不知道想要保存在数据库中我只想保存它的解决方案
i已经检查了一个找到的文件上传解决方案,但在Winform Fileupload控件不可用
3. savedialog box
4. open dialog box
And i don't want save in database i just want to save it a floder of my solution
i have checked on web one solution found with file upload but in Winform Fileupload control not available
推荐答案
//build save to folder path using application path
string saveToPath = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "FileFolder");
//combine path with original file name and build full path
string saveToFullPath= Path.Combine(saveToPath, Path.GetFileName(dlg.FileName));
//copy file to folder
System.IO.File.Copy(dlg.FileName, saveToFullPath);
这篇关于如何使用ImageEdit cotrol将图像地址存储在文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文