public static void Operatemapdoc (Axmapcontrol axmapc,string Path, string stroperatetype) {try {////Definition Open file dialog box//openfiledialog Openfiledlg = new OpenFileDialog (); Define Save File dialog box//savefiledialog Savefiledlg = new SaveFileDialog (); Openfiledlg.filter = "Map document file (*.MXD) |*.mxd"; Savefiledlg.filter = "Map document file (*.MXD) |*.mxd"; String Strdocfilen = String. Empty; Determine the type of operation Document Map switch (stroperatetype) {case "Savedoc": { Pmapdocument = new Mapdocumentclass (); Pmapdocument.open (Path, ""); Determine if the document is a read-only document//if (Pmapdocument.get_isreadonly (pmapdocument.documentfilename) = = True) {//DevExpress.XtraEditors.XtraMessageBox.Show ("This map document is a read-only document!) "," information tip "); Return }//Save map document with relative path//pmapdocument.save (true, true); Imxdcontents pmxdc; PMXDC = Axmapc.map as imxdcontents; Imapdocument pmapdocument = new Mapdocumentclass (); Pmapdocument.new (path); Iactiveview Pactiveview = Axmapc.map as Iactiveview; Pmapdocument.replacecontents (PMXDC); Pmapdocument.save (True, true); Pmapdocument.close (); DevExpress.XtraEditors.XtraMessageBox.Show ("Saved successfully! "," information tip "); Break } Default:break; }} catch (Exception e) {DevExpress.XtraEditors.XtraMessageBox.Show (e.mes Sage, "information tip"); Return } }
AE Save Layer