當前位置:編程學習大全網 - 網站源碼 - 新學習,求教。Arcgis Engine開發中加載地圖文檔的代碼,出現異常。

新學習,求教。Arcgis Engine開發中加載地圖文檔的代碼,出現異常。

妳好!在妳上面的代碼中我看出壹點問題。

可能是妳的 openFileDialog2控件沒有選中任何文件的原因。

妳可以用壹個

If( openFileDialog2.showDialog()=DialogResult.OK)判斷用戶是否選擇文件之後再執行下面的代碼。

可以這樣修改妳的代碼

if(openFileDialog2.showDialog()==DialogResult.OK)

{

string FilePath = openFileDialog2.FileName;

if (axMapControl1.CheckMxFile(FilePath))

{

axMapControl1.MousePointer = ESRI.ArcGIS.Controls.esriControlsMousePointer.esriPointerHourglass;

axMapControl1.LoadMxFile(FilePath, 0, Type.Missing);

axMapControl1.MousePointer = ESRI.ArcGIS.Controls.esriControlsMousePointer.esriPointerDefault;

}

else

{

MessageBox.Show(FilePath+"is not a vaild ArcMap document");

return;

}

}

else

{

MessageBox.Show("沒有找到任何文件");

}

  • 上一篇:流量精靈上面的流量數是真的還是假的?
  • 下一篇:cf修改客戶端封號怎麽解決
  • copyright 2024編程學習大全網