如何在Winforms C#中将图像复制到文件夹 [英] how to copy image in to folder in Winforms C#

查看:76
本文介绍了如何在Winforms C#中将图像复制到文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

该进程无法访问文件'D:\\Images\Logo.jpg',因为它正由另一个进程使用。



i am using这个文件夹中的复制图像的格式:



  string  P_Path = dt1 .Rows [ 0 ] [  Path]。ToString()+   Logo + Extention; 
System.IO.File.Delete(P_Path);
System.IO.File.Copy(PhotoPath + @ \ + filename, P_Path, true );





但是只工作一次,当我第二次复制时显示此错误: -



进程无法访问文件'D:\\Images\Logo.jpg',因为它正在被另一个进程使用。

解决方案

只需检查以下链接可能会有帮助。



http://stackoverflow.com/questions/3109294/上传-光因为-IT-是感使用的逐另一进程

The process cannot access the file 'D:\\Images\Logo.jpg' because it is being used by another process.

i am using this fode for copy image in folder :

string P_Path = dt1.Rows[0]["Path"].ToString() + "Logo" + Extention;
                                                                               System.IO.File.Delete(P_Path);
System.IO.File.Copy(PhotoPath + @"\" + filename, P_Path, true);



but is is work only one time, when i am copy second time then display this error :-

The process cannot access the file 'D:\\Images\Logo.jpg' because it is being used by another process.

解决方案

Just check the below link may be it helps.

http://stackoverflow.com/questions/3109294/uploading-photo-because-it-is-being-used-by-another-process


这篇关于如何在Winforms C#中将图像复制到文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆