zhanzhiyuan
路人甲
路人甲
  • 注册日期2007-02-26
  • 发帖数3
  • QQ
  • 铜币111枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1419回复:1

[下载]共享AO资料

楼主#
更多 发布于:2008-01-23 01:17
IMapDocument m_MapDocument;<BR>private void LoadMapDoc()<BR>{<BR>m_MapDocument = new MapDocumentClass();<BR>try<BR>{<BR>//&#1054759;&#1053908;&#1055579;&#1049802;&#1053133;&#1065393;&#1056282;&#1066461;&#1051050;MXD&#1055579;&#1049802;<BR>System.Windows.Forms.OpenFileDialog openFileDialog2;<BR>openFileDialog2 = new OpenFileDialog();<BR>openFileDialog2.Title = "Open Map Document";<BR>openFileDialog2.Filter = "Map Documents (*.mxd)|*.mxd";<BR>openFileDialog2.ShowDialog();<BR>string sFilePath = openFileDialog2.FileName;<BR>//&#1053146;&#1055556;&#1055042;&#1066321;&#1050425;pMapDocument&#1053770;&#1049570;map&#1055099;&#1049802;&#1062440;&#1061583;&#1065803;&#1056057;<BR>m_MapDocument.Open(sFilePath, "");<BR>int i;<BR>for (i = 0 ; i<= pMapDocument.MapCount - 1;i++)<BR>{<BR>//&#1049556;&#1049598;IMapDocument&#1053133;&#1065525;&#1049601;&#1051075;&#1062609;&#1055965;&#1052398;&#1049598;Map&#1053133;&#1065525;&#1049288;&#1066529;&#1050970;&#1057187;&#1049598;map&#1053133;&#1065525;<BR>axMapControl1.Map = m_MapDocument.get_Map(i);<BR>}<BR>//&#1050635;&#1055620;&#1051908;&#1051858;<BR>axMapControl1.Refresh();<BR>}<BR>catch( Exception ex)<BR>{<BR>MessageBox.Show(ex.ToString());<BR>}<BR>}<BR>private void SaveDocument()<BR>{<BR>100<BR>//Check that the document is not read only<BR>if (m_MapDocument.get_IsReadOnly(m_MapDocument.DocumentFilename)<BR>== true)<BR>{<BR>MessageBox.Show("This map document is read only!");<BR>return;<BR>}<BR>//Save with the current relative path setting<BR>m_MapDocument.Save(m_MapDocument.UsesRelativePaths,true);<BR>MessageBox.Show("Changes saved successfully!");<BR>}<BR>private void SaveAsDocument ()<BR>{<BR>//Open a file dialog for saving map documents<BR>saveFileDialog1.Title = "Save Map Document As";<BR>saveFileDialog1.Filter = "Map Documents (*.mxd)|*.mxd";<BR>saveFileDialog1.ShowDialog();<BR>//Exit if no map document is selected<BR>string sFilePath = saveFileDialog1.FileName;<BR>if (sFilePath == "")<BR>{<BR>return;<BR>}<BR>if (sFilePath == m_MapDocument.DocumentFilename)<BR>{<BR>//Save changes to the current document<BR>SaveDocument();<BR>}<BR>else<BR>{<BR>//SaveAs a new document with relative paths<BR>m_MapDocument.SaveAs(sFilePath, true, true);<BR>//Open document<BR>OpenDocument((sFilePath));<BR>MessageBox.Show("Document saved successfully!");<BR>101<BR>}<BR>}<BR>&#1055620;&#1053902;&#1049556;&#1049598;&#1060942;&#1059928;&#1051908;&#1051858;&#1055579;&#1056311;&#1049288;&#1053770;&#1053146;&#1050442;&#1066321;&#1052502; MapControl &#1059928;&#1049783;&#1060309;&#1052502;&#1049567;&#1049302;<BR>private void mnuNew_Click(object sender, System.EventArgs e)<BR>{<BR>// IMap pMap = new MapClass();<BR>// axMapControl1.Map = pMap ;<BR>MapDocument pMapDocument = new MapDocumentClass();<BR>string sFilePath = @"d:\temp\untitled.mxd";<BR>pMapDocument.New(sFilePath);<BR>pMapDocument.Open(sFilePath,"");<BR>axMapControl1.Map = pMapDocument.get_Map(0);<BR>}
喜欢0 评分0
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
1楼#
发布于:2008-01-23 09:13
<P>毫无说明,这个。。。太马虎了</P>
<P>而且只是一个加载mxd文档的功能,改进改进</P><img src="images/post/smile/dvbbs/em02.gif" />
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
游客

返回顶部