public static string paths(string one)
{
int p = 0; //p记录你当前项目的几级目录 也就是说有几个"\\"
one = one.Substring(0, one.Length - 9); //为什么减9呢,因为 pathA获得的路径包括"\bin\Debug",求的是根目录,所以减9
string path11 = "MAP\\基础教育数据1.mxd";
int i = one.Length;
//path11 为了显示看得明显
for (int j = 0; j < i; j++)
{
if (one.Substring(j, 1) == "\\")
{
p++;
}
}
//for (int ss = 1; ss < p; ss++)
/////为什么从1开始,因为上面算出的"\\"个数要减一个
///// 相对路径从硬盘根目录上开始,例如: D:\\这个 "\\"不用计算
/////
//{
path11 = one.ToString()+ path11;
//}
return path11;
}
private void MainForm_Load(object sender, EventArgs e)
{
string path = System.Windows.Forms.Application.StartupPath.ToString();
string pp = paths(path);
//get the MapControl
m_mapControl = (IMapControl3)axMapControl1.Object;
menuSaveDoc.Enabled = false;
axMapControl1.LoadMxFile(pp,Type.Missing,Type.Missing);
axMapControl1.Refresh(); }
axMapControl1.LoadMxFile(pp,Type.Missing,Type.Missing);老提示The specified filename cannot be found;那个地方出错了。
{
int p = 0; //p记录你当前项目的几级目录 也就是说有几个"\\"
one = one.Substring(0, one.Length - 9); //为什么减9呢,因为 pathA获得的路径包括"\bin\Debug",求的是根目录,所以减9
string path11 = "MAP\\基础教育数据1.mxd";
int i = one.Length;
//path11 为了显示看得明显
for (int j = 0; j < i; j++)
{
if (one.Substring(j, 1) == "\\")
{
p++;
}
}
//for (int ss = 1; ss < p; ss++)
/////为什么从1开始,因为上面算出的"\\"个数要减一个
///// 相对路径从硬盘根目录上开始,例如: D:\\这个 "\\"不用计算
/////
//{
path11 = one.ToString()+ path11;
//}
return path11;
}
private void MainForm_Load(object sender, EventArgs e)
{
string path = System.Windows.Forms.Application.StartupPath.ToString();
string pp = paths(path);
//get the MapControl
m_mapControl = (IMapControl3)axMapControl1.Object;
menuSaveDoc.Enabled = false;
axMapControl1.LoadMxFile(pp,Type.Missing,Type.Missing);
axMapControl1.Refresh(); }
axMapControl1.LoadMxFile(pp,Type.Missing,Type.Missing);老提示The specified filename cannot be found;那个地方出错了。
解决方案 »
- C#GDI+绘制一个椭圆,如何判断某个点是否在椭圆上?
- WPF:TabControl的页面是什么控件?为什么TabControl类没有children这个成员?
- 有兴趣的朋友看看,一个简单的算法?计算出一个随即数组每个字符串出现的个数
- VS2008 SQL2008 硬件配置要求!
- 求高手!解释代码!
- .net c# 网站发布遇到的问题
- 各位对 Smart Client有何评价
- 发送广播消息
- 大神求助啊!!!
- 高手介绍windows DNA,Com+ , MTS , 设计模式 它们之间的关系 和异同 及应用场合
- C#用本窗体的contextmenustrip打开关闭另一窗体
- 线程中的参数是Hashtable类型的,线程接收的时候是object的,怎么取值
pp = "C:\\Documents and Settings\\Administrator\\桌面\\MapControlApplication1\\MapControlApplication1\\MAP\\基础教育数据1.mxd"