阅读:3496回复:13
请问怎么将pagelayout或mapcontrol中的当前地图保存为mxd文件!!!
请问怎么将pagelayout或mapcontrol中的当前地图保存为mxd文件!!!
|
|
1楼#
发布于:2005-04-06 15:43
这个在控件命令里就有了,直接调用就ok了吧
|
|
|
2楼#
发布于:2005-04-07 16:37
mapcontrol中是不能直接保存为mxd文件,不知道该怎么处理?好像有个IContent什么的接口可以搞定,不知道怎么处理!
|
|
3楼#
发布于:2005-04-19 11:22
thanks
|
|
4楼#
发布于:2005-04-19 11:25
<DIV class=quote><B>以下是引用<I>aicai</I>在2005-4-7 16:37:57的发言:</B>
mapcontrol中是不能直接保存为mxd文件,不知道该怎么处理?好像有个IContent什么的接口可以搞定,不知道怎么处理!</DIV> <P>在toolbarcontrol里已经提供了保存mxd的命令啊</P> |
|
|
5楼#
发布于:2005-04-19 20:44
问题还是没有解决,希望大家提供帮助!!1
|
|
6楼#
发布于:2005-04-30 20:46
void SaveDocument()
{ if(m_MapDocument.get_IsReadOnly(m_MapDocument.DocumentFilename)==true) { MessageBox.Show("This Map Document is read only!"); return; } m_MapDocument.Save(m_MapDocument.UsesRelativePaths,true); //MessageBox.Show("Changes saved successfuly!"); } |
|
7楼#
发布于:2005-04-30 21:28
<P>SaveMapDocument.frm
Option Explicit</P> <P>Private m_pAoInitialize As IAoInitialize Private m_pMapDocument As IMapDocument</P> <P>Private Sub cmdOpen_Click()</P> <P> 'Open a file dialog for opening map documents CommonDialog1.DialogTitle = "Open Map Document" CommonDialog1.Filter = "Map Documents (*.mxd)|*.mxd" CommonDialog1.ShowOpen 'Exit if no map document is selected Dim sFilePath As String sFilePath = CommonDialog1.FileName If sFilePath = "" Then Exit Sub 'Open document OpenDocument (sFilePath) If cmdSave.Enabled = False Then cmdSave.Enabled = True If cmdSaveAs.Enabled = False Then cmdSaveAs.Enabled = True End Sub</P> <P>Private Sub cmdSave_Click() 'Save changes to the current document SaveDocument</P> <P>End Sub</P> <P>Private Sub cmdSaveAs_Click()</P> <P> 'Open a file dialog for saving map documents CommonDialog1.DialogTitle = "Save Map Document As" CommonDialog1.Filter = "Map Documents (*.mxd)|*.mxd" CommonDialog1.ShowSave</P> <P> 'Exit if no map document is selected Dim sFilePath As String sFilePath = CommonDialog1.FileName If sFilePath = "" Then Exit Sub If sFilePath = m_pMapDocument.DocumentFilename Then 'Save changes to the current document SaveDocument Else 'SaveAs a new document with relative paths m_pMapDocument.SaveAs sFilePath, True 'Open document OpenDocument (sFilePath) MsgBox "Document saved successfully!", , "Saved Document" End If End Sub</P> <P>Private Sub Form_Load() 'Create a new AoInitialize object Set m_pAoInitialize = New AoInitialize If m_pAoInitialize Is Nothing Then MsgBox "Unable to initialize. This application cannot run!" Unload Form1 Exit Sub End If 'Determine if the product is available If m_pAoInitialize.IsProductCodeAvailable(esriLicenseProductCodeEngine) = esriLicenseAvailable Then If m_pAoInitialize.Initialize(esriLicenseProductCodeEngine) <> esriLicenseCheckedOut Then MsgBox "The initialization failed. This application cannot run!" Unload Form1 Exit Sub End If Else MsgBox "The ArcGIS Engine product is unavailable. This application cannot run!" Unload Form1 Exit Sub End If 'Add toolbar definitions to the ToolbarControl ToolbarControl1.AddToolbarDef "esriControlCommands.ControlsPageLayoutToolbar", -1, False, 0, esriCommandStyleIconOnly ToolbarControl1.AddToolbarDef "esriControlCommands.ControlsGraphicElementToolbar", -1, True, 0, esriCommandStyleIconOnly 'Set buddy control ToolbarControl1.SetBuddyControl PageLayoutControl1 TOCControl1.SetBuddyControl PageLayoutControl1 cmdSave.Enabled = False cmdSaveAs.Enabled = False</P> <P>End Sub</P> <P>Private Sub Form_Unload(Cancel As Integer)</P> <P> 'Shut down the AoInitilaize object m_pAoInitialize.Shutdown</P> <P>End Sub</P> <P>Public Sub OpenDocument(sFilePath As String) 'Create a new map document Set m_pMapDocument = New MapDocument 'Open the map document selected m_pMapDocument.Open sFilePath 'Set the PageLayoutControl page layout to the map document page layout Set PageLayoutControl1.PageLayout = m_pMapDocument.PageLayout txtMapDocument.Text = m_pMapDocument.DocumentFilename</P> <P>End Sub</P> <P>Public Sub SaveDocument()</P> <P> 'Check that the document is not read only If m_pMapDocument.IsReadOnly(m_pMapDocument.DocumentFilename) = True Then MsgBox "This map document is read only!", , "Save Failed" Exit Sub End If 'Save with the current relative path setting m_pMapDocument.Save m_pMapDocument.UsesRelativePaths MsgBox "Changes saved successfully!", , "Saved Document"</P> <P>End Sub</P> <P> </P> [此贴子已经被作者于2005-4-30 21:29:16编辑过]
|
|
|
8楼#
发布于:2005-05-06 21:24
Ao里面没有这个IMapDocument接口啊!!!!,你是engine吧,这个我没用过!!!!!!!!!!!!!!!!!!!<img src="images/post/smile/dvbbs/em05.gif" /><img src="images/post/smile/dvbbs/em02.gif" /><img src="images/post/smile/dvbbs/em01.gif" />
|
|
9楼#
发布于:2005-05-07 10:46
Ao里面怎么没有这个IMapDocument接口啊!!!!,
|
|
上一页
下一页