arcgis Map c#进程无法访问文件C:\ Users ..,因为该文件正在由另一个进程使用 [英] arcgis Map c# The process cannot access the file C:\Users.. because it is being used by another process
本文介绍了arcgis Map c#进程无法访问文件C:\ Users ..,因为该文件正在由另一个进程使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在arcgis c#中有问题.我正在使用Arcgis axMapControl组件并向其中添加图像,但是当我想从axMapControl组件中删除图像时我无法删除图像...我遇到了一个异常,例如该进程无法访问文件C:\ Users ..,因为它是被另一个进程使用我需要您的帮助:),非常感谢您的帮助:)
示例代码
I have a problem in arcgis c#. I am using Arcgis axMapControl component and adding image to it but I can not delete image when wanted to delete from axMapControl component... I have get a exception such as " The process cannot access the file C:\Users.. because it is being used by another process " I need your help :) and verryyy thankss for your helps :)
example code
public void Add_map()
{
IRasterLayer my_raster = new RasterLayer();
my_raster.FromFile(path);
AxMapControl1.AddLayer(my_raster);
}
--------------------------------------------------
public void Delete_map()
{
AxMapControl1.DeleteLayer(0);
System.IO.File.delete(path); //There is a Exception.... This problem...
}
推荐答案
路径"应为有效路径,例如"c:\ filename.ext"等.如果它是变量,则应执行此操作:
"path" should be a valid path like "c:\filename.ext" etc. if it is a variable the you should be doing :
System.IO.File.delete(path);
我举了一个例子...路径有效,但仍然无法删除图像....我使用了Dispose()方法,但结果仍然相同:(
I gave an example... Path is valid but still I cannot delete image.... I used Dispose() method but still same the result :(
有人可以帮助我:(非常重要.
can someone help me :( very important.
这篇关于arcgis Map c#进程无法访问文件C:\ Users ..,因为该文件正在由另一个进程使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文