Skip to content

Instantly share code, notes, and snippets.

@helderdek
Created September 3, 2019 14:09
Show Gist options
  • Save helderdek/2869da459d126bbb319edb110f9108ff to your computer and use it in GitHub Desktop.
Save helderdek/2869da459d126bbb319edb110f9108ff to your computer and use it in GitHub Desktop.
Transformando um AxMapControl em arquivo .MXD
public void saveMap()
{
IMapDocument mapDocument = new MapDocumentClass();
mapDocument.Open("C:\\temp\\Teste.mxd", string.Empty);
//if (mapDocument.get_IsReadOnly(@"[path to your .mxd]"))
//{
// System.Windows.Forms.MessageBox.Show("Map document \"" + @"[path to your .mxd]" + "\" is read only!");
// mapDocument.Close();
// return;
//}
mapDocument.ReplaceContents((IMxdContents)axMapControlPrincipal.Map);
mapDocument.SaveAs("C:\\temp\\Teste1.mxd", false, true);
mapDocument.Close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment