//全图 private void BtnViewAll_Click_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ICommand Cmd = new ControlsMapFullExtentCommand(); Cmd.OnCreate(this.axMapControl1.Object); Cmd.OnClick(); }
//全图显示 private void Btn_ViewEntire_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ICommand full = new ControlsMapFullExtentCommand(); full.OnCreate(axMapControl_1.Object); full.OnClick(); }
private void mxd_open_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.InitialDirectory = initPath; ofd.Filter = "Map Document|*.mxd||*.*"; ofd.RestoreDirectory = true; ofd.FilterIndex = 1; if (ofd.ShowDialog() == DialogResult.OK) { IMapControlDefault pMCD; //定义一个接口 pMCD = axMapControl1.Object as IMapControlDefault; //向上转型,实现接口的方法 string strFileName = ofd.FileName; bool bRet = pMCD.CheckMxFile(strFileName); if (bRet) { pMCD.LoadMxFile(strFileName, null, Type.Missing); ICommand Cmd = new ControlsMapFullExtentCommand(); Cmd.OnCreate(this.axMapControl1.Object); Cmd.OnClick(); } pMCD = axMapControl2.Object as IMapControlDefault; if (bRet) { pMCD.LoadMxFile(strFileName, null, Type.Missing); ICommand Cmd = new ControlsMapFullExtentCommand(); Cmd.OnCreate(this.axMapControl2.Object); Cmd.OnClick(); } } }
private void fullExtent_mapToolbarItem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ICommand fullExtentTool = new ControlsMapFullExtentCommand(); fullExtentTool.OnCreate(m_mapControl.Object); fullExtentTool.OnClick(); }
private void fullExtend_click(object sender, EventArgs e) { ICommand cmd = new ControlsMapFullExtentCommand(); cmd.OnCreate(this.mapControl.Object); cmd.OnClick(); }
private void Form1_Load(object sender, EventArgs e) { int index = Environment.CurrentDirectory.IndexOf(@"\bin"); initPath = Environment.CurrentDirectory.Substring(0, index); //加载地图(相对路径) axMapControl1.LoadMxFile(initPath + @"\map\biye.mxd"); ICommand Cmd = new ControlsMapFullExtentCommand(); Cmd.OnCreate(this.axMapControl1.Object); Cmd.OnClick(); //加载鹰眼图(相对路径) axMapControl2.LoadMxFile(initPath + @"\map\biye.mxd"); ICommand Cmd1 = new ControlsMapFullExtentCommand(); Cmd1.OnCreate(this.axMapControl2.Object); Cmd1.OnClick(); }
//打开 private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.InitialDirectory = "D:\\大连矢量化\\"; ofd.Filter = "Map Document|*.mxd"; ofd.RestoreDirectory = true; ofd.FilterIndex = 1; if (ofd.ShowDialog() == DialogResult.OK) { IMapControlDefault pMCD; pMCD = axMapControl1.Object as IMapControlDefault; string strFileName = ofd.FileName; bool bRet = pMCD.CheckMxFile(strFileName); if (bRet) { pMCD.LoadMxFile(strFileName, null, Type.Missing); axMapEve.LoadMxFile(strFileName); ICommand Cmd = new ControlsMapFullExtentCommand(); Cmd.OnCreate(this.axMapEve.Object); Cmd.OnClick(); } } }