wjhgis
路人甲
路人甲
  • 注册日期2005-03-11
  • 发帖数67
  • QQ
  • 铜币359枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:3496回复:13

请问怎么将pagelayout或mapcontrol中的当前地图保存为mxd文件!!!

楼主#
更多 发布于:2005-04-05 22:47
请问怎么将pagelayout或mapcontrol中的当前地图保存为mxd文件!!!
喜欢0 评分0
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
1楼#
发布于:2005-04-06 15:43
这个在控件命令里就有了,直接调用就ok了吧
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
aicai
路人甲
路人甲
  • 注册日期2003-11-18
  • 发帖数191
  • QQ
  • 铜币740枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2005-04-07 16:37
mapcontrol中是不能直接保存为mxd文件,不知道该怎么处理?好像有个IContent什么的接口可以搞定,不知道怎么处理!
举报 回复(0) 喜欢(0)     评分
wjhgis
路人甲
路人甲
  • 注册日期2005-03-11
  • 发帖数67
  • QQ
  • 铜币359枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2005-04-19 11:22
thanks
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
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>
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
wjhgis
路人甲
路人甲
  • 注册日期2005-03-11
  • 发帖数67
  • QQ
  • 铜币359枚
  • 威望0点
  • 贡献值0点
  • 银元0个
5楼#
发布于:2005-04-19 20:44
问题还是没有解决,希望大家提供帮助!!1
举报 回复(0) 喜欢(0)     评分
Yukang_eRen
路人甲
路人甲
  • 注册日期2004-11-12
  • 发帖数2
  • QQ
  • 铜币122枚
  • 威望0点
  • 贡献值0点
  • 银元0个
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!");
  }
举报 回复(0) 喜欢(0)     评分
waterblue
路人甲
路人甲
  • 注册日期2004-09-02
  • 发帖数72
  • QQ
  • 铜币387枚
  • 威望0点
  • 贡献值0点
  • 银元0个
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编辑过]
http://www.geostar.com.cn(吉奥 公司) http://www.waterblue.com.cn(水之灵,蓝之静 个人)
举报 回复(0) 喜欢(0)     评分
wjhgis
路人甲
路人甲
  • 注册日期2005-03-11
  • 发帖数67
  • QQ
  • 铜币359枚
  • 威望0点
  • 贡献值0点
  • 银元0个
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" />
举报 回复(0) 喜欢(0)     评分
wjhgis
路人甲
路人甲
  • 注册日期2005-03-11
  • 发帖数67
  • QQ
  • 铜币359枚
  • 威望0点
  • 贡献值0点
  • 银元0个
9楼#
发布于:2005-05-07 10:46
Ao里面怎么没有这个IMapDocument接口啊!!!!,
举报 回复(0) 喜欢(0)     评分
上一页
游客

返回顶部