阅读:1743回复:3
[求助]请教ArcEngine中另存为的问题
<P>这个是我照着它的sample中的SaveAs自己改写的</P>
<P>Private Sub mnuSaveAs_Click()<BR> dlgOpenFile1.DialogTitle = "文件另存为"<BR> dlgOpenFile1.Filter = "ArcMap Documents(*.mxd)|*.mxd|ArcMap Templates(*.mxt)|*.mxt|Published Maps(*.pmf)|*.pmf"<BR> dlgOpenFile1.ShowSave<BR> <BR> Dim sFile As String<BR> Dim temp As Integer<BR> sFile = dlgOpenFile1.FileName<BR> If sFile = "" Then Exit Sub<BR> If mapDocument.IsReadOnly(mapDocument.DocumentFilename) = True Then<BR> MsgBox "这个一个只读文件,不能替换它!", vbCritical, "保存失败"<BR> Exit Sub<BR> End If<BR> If sFile = mapDocument.DocumentFilename Then<BR> temp = MsgBox(sFile ; "已存在。要替换它吗?", vbOKCancel, "另存为")<BR> If temp = 1 Then<BR> mapDocument.Save mapDocument.UsesRelativePaths<BR> Else: Exit Sub<BR> End If<BR> Else<BR> mapDocument.SaveAs sFile, True<BR> End If<BR>End Sub</P> <P>现在有一个问题不能解决,就是:</P> <P>假如我现在打开的是A.mxd文件,然后点中SaveAs以后,在弹出的对话框里,我选中了已经存在的B.mxd文件,然后点保存,我希望这个时候可以弹出一个对话框,提示“B文件已经存在,要替换它吗?”</P> <P>望各位指点一下</P> |
|
1楼#
发布于:2006-04-03 11:48
谢了,不过我现在的saveas还是用arcengine自己的toolbar里的saveas了,save好像还是要自己写
|
|
2楼#
发布于:2006-03-31 11:00
<P>用FileSystemObject的FileExist判断保存的那个路径</P>
|
|
3楼#
发布于:2006-03-27 17:11
<P>还一个问题忘了说了,就是</P>
<P> If mapDocument.IsReadOnly(mapDocument.DocumentFilename) = True Then<BR> MsgBox "这个一个只读文件,不能替换它!", vbCritical, "保存失败"<BR> Exit Sub<BR> End If</P> <P>这里即使我打开的是一个只读文件,但是这一步有的时候会自己跳过去,接着执行它后面的代码,好像是把该文件当成非只读文件处理了(VB中我用F8一行一行查的时候,会发现这里会跳过去),这个时候我把这些代码重新打一遍,问题就解决了,谁能和我说一下为什么吗?</P> |
|