/// <summary> /// Occurs when this tool is created /// </summary> /// <param name="hook">Instance of the application</param> public override void OnCreate(object hook) { if (hook == null) { return; } if (m_hookHelper == null) { m_hookHelper = new HookHelperClass(); } m_hookHelper.Hook = hook; IMapControl2 pMapCtr = (((IToolbarControl)m_hookHelper.Hook).Buddy) as IMapControl2; if (pMapCtr != null) { pMap = pMapCtr.Map; } IPageLayoutControl pLayoutCtr = (((IToolbarControl)m_hookHelper.Hook).Buddy) as IPageLayoutControl; if (pLayoutCtr != null) { pMap = pLayoutCtr.ActiveView.FocusMap; } frmAddTINNode.Owner = System.Windows.Forms.Form.FromChildHandle(User32API.GetCurrentWindowHandle()) as System.Windows.Forms.Form; // TODO: Add toolAddTinNode.OnCreate implementation }
public FrmGeneratePDFReport(IMapControl3 mapcontrol, IPageLayoutControl pagelayoutcontrol) { InitializeComponent(); this.EnableGlass = false; pMapcontrol = mapcontrol; pPageLayoutControl = pagelayoutcontrol; }
/// <summary> /// 重写鼠标down事件 /// </summary> /// <param name="sender">事件触发器</param> /// <param name="e">事件参数</param> public override void OnMouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { if (m_HookHelper.ActiveView == null) { return; } //制图模式 else if (m_HookHelper.Hook is IPageLayoutControl) { m_PageLayoutControl = m_HookHelper.Hook as IPageLayoutControl; //画的矩形Extent IEnvelope trackExtent = m_PageLayoutControl.TrackRectangle(); PIE.Geometry.IEnvelope currentExtent = m_PageLayoutControl.ActiveView.DisplayTransformation.VisibleBounds; double xMin, yMin, xMax, yMax; xMin = yMin = xMax = yMax = 0; m_PageLayoutControl.PageLayout.PageToMapPoint(m_HookHelper.FocusMap, trackExtent.XMin, trackExtent.YMin, ref xMin, ref yMin); m_PageLayoutControl.PageLayout.PageToMapPoint(m_HookHelper.FocusMap, trackExtent.XMax, trackExtent.YMax, ref xMax, ref yMax); IEnvelope extent = new Envelope(); extent.PutCoords(xMin, yMin, xMax, yMax); //计算一个缩放比例 double scale = currentExtent.GetWidth() * 1.00 / (trackExtent as IEnvelope).GetWidth(); //缩放比例与地图模式下的基本一致 extent.Expand(scale * 1.3, scale * 1.3, true); (m_PageLayoutControl.FocusMap as IActiveView).Extent = extent; (m_PageLayoutControl.FocusMap as IActiveView).PartialRefresh(ViewDrawPhaseType.ViewAll); } //地图模式 else if (m_HookHelper.Hook is IMapControl) { m_MapControl = m_HookHelper.Hook as IMapControl; //画的矩形Extent IEnvelope trackExtent = m_MapControl.TrackRectangle(); if (trackExtent == null) { return; } //获取当前的Extent IEnvelope currentExtent = m_MapControl.Extent; IEnvelope newExtent = null; //创建一个新的Extent double dWidth = currentExtent.GetWidth() * (currentExtent.GetWidth() / trackExtent.GetWidth()); double dHeight = currentExtent.GetHeight() * (currentExtent.GetHeight() / trackExtent.GetHeight()); double dXmin = currentExtent.XMin - ((trackExtent.XMin - currentExtent.XMin) * (currentExtent.GetWidth() / trackExtent.GetWidth())); double dYmin = currentExtent.YMin - ((trackExtent.YMin - currentExtent.YMin) * (currentExtent.GetHeight() / trackExtent.GetHeight())); double dXmax = (currentExtent.XMin - ((trackExtent.XMin - currentExtent.XMin) * (currentExtent.GetWidth() / trackExtent.GetWidth()))) + dWidth; double dYmax = (currentExtent.YMin - ((trackExtent.YMin - currentExtent.YMin) * (currentExtent.GetHeight() / trackExtent.GetHeight()))) + dHeight; //设置extent coordinate newExtent = new Envelope(); newExtent.PutCoords(dXmin, dYmin, dXmax, dYmax); m_MapControl.Extent = newExtent; m_MapControl.PartialRefresh(ViewDrawPhaseType.ViewAll); } }
/// <summary> /// Occurs when this command is created /// </summary> /// <param name="hook">Instance of the application</param> public override void OnCreate(object hook) { if (hook == null) { return; } if (m_hookHelper == null) { m_hookHelper = new HookHelperClass(); } m_hookHelper.Hook = hook; IMapControl2 pMapCtr = (((IToolbarControl)m_hookHelper.Hook).Buddy) as IMapControl2; if (pMapCtr != null) { pMap = pMapCtr.Map; } IPageLayoutControl pLayoutCtr = (((IToolbarControl)m_hookHelper.Hook).Buddy) as IPageLayoutControl; if (pLayoutCtr != null) { pMap = pLayoutCtr.ActiveView.FocusMap; } // TODO: Add other initialization code }
private void cboMaps_SelectedIndexChanged(object sender, System.EventArgs e) { IPageLayoutControl pageLayoutControl = (IPageLayoutControl)axPageLayoutControl1.GetOcx(); //Get IMapFrame interface IMapFrame element = (IMapFrame)pageLayoutControl.FindElementByName(cboMaps.Text, 1); //Set the FocusMap axPageLayoutControl1.ActiveView.FocusMap = element.Map; }
public void OnCreate(IApplication hook) { if (hook != null) { this.hk = hook; this._PageLayoutControl = hk.PageLayoutControl as IPageLayoutControl; pfrmBiodiversity = new frmBiodiversity(_PageLayoutControl); pfrmBiodiversity.Visible = false; } }
public void OnCreate(IApplication hook) { if (hook != null) { this.hk = hook; this._PageLayoutControl = hk.PageLayoutControl as IPageLayoutControl; pfrmTerrain = new frmTerrain(_PageLayoutControl); pfrmTerrain.Visible = false; } }
public FrmExportToCAD(IMapControl3 mapcontrol, IPageLayoutControl pagelayoutcontrol) { InitializeComponent(); pMapcontrol = mapcontrol; pPageLayoutControl = pagelayoutcontrol; if (comboBox1.Items.Count > 0) { comboBox1.SelectedIndex = 0; } }
private void Form1_Load(object sender, System.EventArgs e) { m_PageLayoutControl = (IPageLayoutControl)axPageLayoutControl2.Object; //Set PageLayoutControl properties axPageLayoutControl1.Enabled = true; m_PageLayoutControl.Enabled = false; axPageLayoutControl1.Appearance = esriControlsAppearance.esri3D; m_PageLayoutControl.Appearance = esriControlsAppearance.esriFlat; axPageLayoutControl1.BorderStyle = esriControlsBorderStyle.esriBorder; m_PageLayoutControl.BorderStyle = esriControlsBorderStyle.esriNoBorder; }
public bool LoadPageLayoutTemplate(IPageLayoutControl pPageControl, string sTemplateID) { try { if (pPageControl == null) { Interaction.MsgBox("地图模板加载失败,控件 PageLayoutControl 加载失败。", MsgBoxStyle.Exclamation, "错误警告"); return(false); } if (string.IsNullOrEmpty(Strings.Trim(sTemplateID))) { Interaction.MsgBox("地图模板加载失败,模板ID " + sTemplateID + " 错误。", MsgBoxStyle.Exclamation, "错误警告"); return(false); } string configValue = null; configValue = UtilFactory.GetConfigOpt().GetConfigValue(sTemplateID); if (string.IsNullOrEmpty(configValue)) { Interaction.MsgBox("地图模板加载失败,目录 " + configValue + " 错误。", MsgBoxStyle.Exclamation, "错误警告"); return(false); } if (Strings.Right(configValue, 1) != @"\") { configValue = configValue + @"\"; } string path = null; path = configValue + sTemplateID + ".mxt"; if (!File.Exists(path)) { Interaction.MsgBox("地图模板加载失败,模板文件 " + path + " 不存在。", MsgBoxStyle.Exclamation, "错误警告"); return(false); } if (!pPageControl.CheckMxFile(path)) { Interaction.MsgBox("地图模板加载失败,模板文件 " + path + " 内存在错误。", MsgBoxStyle.Exclamation, "错误警告"); return(false); } pPageControl.LoadMxFile(path, null); IActiveView activeView = pPageControl.ActiveView; if (activeView.GraphicsContainer != null) { IViewManager manager = activeView as IViewManager; ISelection elementSelection = manager.ElementSelection; activeView.Selection = elementSelection; } return(true); } catch (Exception exception) { this.mErrOpt.ErrorOperate(this.mSubSysName, "FunFactory.CoreFun", "LoadPageLayoutTemplate", exception.GetHashCode().ToString(), exception.Source, exception.Message, "", "", ""); return(false); } }
public void setPageLayout(ref IPageLayoutControl ipageLayoutControl_1) { this.ipageLayoutControl_0 = ipageLayoutControl_1; try { this.iprinter_0 = (this.ipageLayoutControl_0.Printer as IClone).Clone() as IPrinter; this.ipage_0 = (this.ipageLayoutControl_0.Page as IClone).Clone() as IPage; } catch (Exception) { } }
private void frmPrintLayout_Load(object sender, EventArgs e) { pageLayoutControl = m_hookHelper.Hook as IPageLayoutControl; if (pageLayoutControl == null) { return; } //Add esriPageFormID constants to drop down cboPageSize.Items.Add("Letter - 8.5in x 11in."); cboPageSize.Items.Add("Legal - 8.5in x 14in."); cboPageSize.Items.Add("Tabloid - 11in x 17in."); cboPageSize.Items.Add("C - 17in x 22in."); cboPageSize.Items.Add("D - 22in x 34in."); cboPageSize.Items.Add("E - 34in x 44in."); cboPageSize.Items.Add("A5 - 148mm x 210mm."); cboPageSize.Items.Add("A4 - 210mm x 297mm."); cboPageSize.Items.Add("A3 - 297mm x 420mm."); cboPageSize.Items.Add("A2 - 420mm x 594mm."); cboPageSize.Items.Add("A1 - 594mm x 841mm."); cboPageSize.Items.Add("A0 - 841mm x 1189mm."); cboPageSize.Items.Add("Custom Page Size."); cboPageSize.Items.Add("Same as Printer Form."); cboPageSize.SelectedIndex = 7; //Add esriPageToPrinterMapping constants to drop down cboPageToPrinterMapping.Items.Add("0: Crop"); cboPageToPrinterMapping.Items.Add("1: Scale"); cboPageToPrinterMapping.Items.Add("2: Tile"); cboPageToPrinterMapping.SelectedIndex = 1; optPortrait.Checked = true; EnableOrientation(false); //Display printer details UpdatePrintingDisplay(); //Update page display cboPageSize.SelectedIndex = (int)pageLayoutControl.Page.FormID; cboPageToPrinterMapping.SelectedIndex = (int)pageLayoutControl.Page.PageToPrinterMapping; if (pageLayoutControl.Page.Orientation == 1) { optPortrait.Checked = true; } else { optLandscape.Checked = true; } //Update printer page display UpdatePrintPageDisplay(); }
private void axPageLayoutControl1_OnMouseDown(object sender, IPageLayoutControlEvents_OnMouseDownEvent e) { if (e.button == 1) { // if() //GISHandler.GISTools.addNorthArrow(this.axPageLayoutControl1, axPageLayoutControl1.ActiveView.FocusMap); } if (e.button == 2) { IPageLayoutControl p_mapControl = (IPageLayoutControl)this.axPageLayoutControl1.Object; p_menuLayer.PopupMenu(e.x, e.y, p_mapControl.hWnd); } }
public override void OnClick() { try { this._pageLayoutControl = _context.MainView.PageLayoutControl; FormPrinterSetup formPrinterSetup = new FormPrinterSetup(); formPrinterSetup.setPageLayout(ref this._pageLayoutControl); formPrinterSetup.ShowDialog(); } catch (Exception exception_) { System.Windows.Forms.MessageBox.Show("无法启动打印!"); //CErrorLog.writeErrorLog(this, exception_, ""); } }
public frmFlood(IPageLayoutControl pPageLayoutControl) { InitializeComponent(); this._PageLayoutControl = pPageLayoutControl; //禁用Glass主题 this.EnableGlass = false; //不显示最大化最小化按钮 this.MaximizeBox = false; this.MinimizeBox = false; // this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; //去除图标 this.ShowIcon = false; tb_demnput.Text = System.Environment.CurrentDirectory + "\\Data\\EcoRedLine\\dem.tif"; tb_highinput.Text = "2000"; tb_flooutput.Text = System.Environment.CurrentDirectory + "\\Data\\EcoRedLine\\Flood.tif"; }
public override void OnClick() { this.ipageLayoutControl_0 = this._context.Hook as IPageLayoutControl; if (this.ipageLayoutControl_0 != null) { try { FormPrinterSetup formPrinterSetup = new FormPrinterSetup(); formPrinterSetup.setPageLayout(ref this.ipageLayoutControl_0); formPrinterSetup.ShowDialog(); } catch (Exception exception1) { Exception exception = exception1; MessageBox.Show("无法启动打印!"); CErrorLog.writeErrorLog(this, exception, ""); } } }
public frmBiodiversity(IPageLayoutControl pPageLayoutControl) { InitializeComponent(); this._PageLayoutControl = pPageLayoutControl; //禁用Glass主题 this.EnableGlass = false; //不显示最大化最小化按钮 this.MaximizeBox = false; this.MinimizeBox = false; // this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; //去除图标 this.ShowIcon = false; tb_nppinput.Text = System.Environment.CurrentDirectory + "\\Data\\EcoRedLine\\sun.tif"; tb_preinput.Text = System.Environment.CurrentDirectory + "\\Data\\EcoRedLine\\rain.tif"; tb_tminput.Text = System.Environment.CurrentDirectory + "\\Data\\EcoRedLine\\ta_Resample.tif"; tb_altinput.Text = System.Environment.CurrentDirectory + "\\Data\\EcoRedLine\\dem.tif"; tb_biooutput.Text = System.Environment.CurrentDirectory + "\\Data\\EcoRedLine\\Biodiversity.tif"; }
public override void OnMouseDown(int Button, int Shift, int X, int Y) { // TODO: Add toolAddTinNode.OnMouseDown implementation ITin pTin = pTinLayer.Dataset; ITinEdit pTinEdit = pTin as ITinEdit; pTinEdit.AddPointZ(pAddedPoint, 0); IMapControl2 pMapCtr = (((IToolbarControl)m_hookHelper.Hook).Buddy) as IMapControl2; if (pMapCtr != null) { pMapCtr.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); } IPageLayoutControl pLayoutCtr = (((IToolbarControl)m_hookHelper.Hook).Buddy) as IPageLayoutControl; if (pLayoutCtr != null) { pLayoutCtr.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); } }
public void setPageLayout(ref IPageLayoutControl ipageLayoutControl_1) { if (ipageLayoutControl_1 == null) { ipageLayoutControl_1 = this.frmPageLayoutTemp_0.axPageLayoutControl1.Object as IPageLayoutControl; IMap focusMap = ApplicationRef.Application.FocusMap; this.method_0(this.frmPageLayoutTemp_0.axPageLayoutControl1.ActiveView.FocusMap, (focusMap as IActiveView).Extent); this.method_1(focusMap, this.frmPageLayoutTemp_0.axPageLayoutControl1.ActiveView.FocusMap); } this.ipageLayoutControl_0 = ipageLayoutControl_1; try { this.iprinter_0 = (this.ipageLayoutControl_0.Printer as IClone).Clone() as IPrinter; this.ipage_0 = (this.ipageLayoutControl_0.Page as IClone).Clone() as IPage; } catch (Exception) { } }
public static void SetPrinter(ref IPageLayoutControl pPageControl, ref PrintDocument document) { try { PageSetupDialog pageSetDlg = new PageSetupDialog(); pageSetDlg.PageSettings = new PageSettings(); pageSetDlg.PrinterSettings = new PrinterSettings(); pageSetDlg.ShowNetwork = true; if (pageSetDlg.ShowDialog() == DialogResult.OK) { document.PrinterSettings = pageSetDlg.PrinterSettings; document.DefaultPageSettings = pageSetDlg.PageSettings; int i; IEnumerator paperSizes = pageSetDlg.PrinterSettings.PaperSizes.GetEnumerator(); paperSizes.Reset(); for (i = 0; i < pageSetDlg.PrinterSettings.PaperSizes.Count; ++i) { paperSizes.MoveNext(); if (((PaperSize)paperSizes.Current).Kind == document.DefaultPageSettings.PaperSize.Kind) { document.DefaultPageSettings.PaperSize = ((PaperSize)paperSizes.Current); break; } } IPaper paper; paper = new PaperClass(); //create a paper object IPrinter printer; printer = new EmfPrinterClass(); //create a printer object paper.Attach(pageSetDlg.PrinterSettings.GetHdevmode(pageSetDlg.PageSettings).ToInt32(), pageSetDlg.PrinterSettings.GetHdevnames().ToInt32()); printer.Paper = paper; pPageControl.Printer = printer; } } catch (Exception ex) { MessageBox.Show("打印设置失败:" + ex.Message, "提示"); } }
public frmWaterConervation(IPageLayoutControl pPageLayoutControl) { InitializeComponent(); this._PageLayoutControl = pPageLayoutControl; //禁用Glass主题 this.EnableGlass = false; //不显示最大化最小化按钮 this.MaximizeBox = false; this.MinimizeBox = false; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; //去除图标 this.ShowIcon = false; tb_raininput.Text = System.Environment.CurrentDirectory + "\\Data\\EcoRedLine\\rain.tif"; tb_suninput.Text = System.Environment.CurrentDirectory + "\\Data\\EcoRedLine\\sun.tif"; tb_tminput.Text = System.Environment.CurrentDirectory + "\\Data\\EcoRedLine\\ta_Resample.tif"; tb_luinput.Text = System.Environment.CurrentDirectory + "\\Data\\EcoRedLine\\LandUse.tif"; tb_wcoutput.Text = System.Environment.CurrentDirectory + "\\Data\\EcoRedLine\\waterConervations.tif"; }
public void setPageLayout(ref IPageLayoutControl ipageLayoutControl_1) { this.ipageLayoutControl_0 = ipageLayoutControl_1; }
private void CopyToPageLayout(IGeometry pGeometry, IPageLayoutControl vPagelayout, long lngScale) { }
/// <summary> /// 画图幅的内外图框 思路是先根据图幅的几何形状画外图框 再根据外图框画内图框(边线) /// </summary> /// <param name="lngScale"></param> /// <param name="pGeometry"></param> /// <param name="vPagelayout"></param> private void DrawMapBroderIn(long lngScale, IGeometry pGeometry, IPageLayoutControl vPagelayout) { }
private void OpenTemplateElement(string vType, IGeometry pGeometry, IPageLayoutControl vPagelayout) { }
public void BindControl(IPageLayoutControl pPageLayout, IMapControl2 pMapControl) { this.m_pDataSourceTreeView.Hook = pPageLayout; this.m_pDataSourceTreeView.SetMapCtrl(pMapControl); }
private void Form1_Load(object sender, System.EventArgs e) { m_PageLayoutControl = (IPageLayoutControl) axPageLayoutControl2.Object; //Set PageLayoutControl properties axPageLayoutControl1.Enabled = true; m_PageLayoutControl.Enabled = false; axPageLayoutControl1.Appearance = esriControlsAppearance.esri3D; m_PageLayoutControl.Appearance = esriControlsAppearance.esriFlat; axPageLayoutControl1.BorderStyle = esriControlsBorderStyle.esriBorder; m_PageLayoutControl.BorderStyle = esriControlsBorderStyle.esriNoBorder; }
public override void OnMouseMove(int Button, int Shift, int X, int Y) { ITin pTin = pTinLayer.Dataset; ITinEdit pTinEdit = pTin as ITinEdit; ISurface pSurface = ((ITinAdvanced)pTin).Surface; IMapControl2 pMapCtr = (((IToolbarControl)m_hookHelper.Hook).Buddy) as IMapControl2; //在mapctr操作 if (pMapCtr != null) { IPoint mapPoint = pMapCtr.ToMapPoint(X, Y); IZAware za = mapPoint as IZAware; za.ZAware = true; double zVal; if (frmAddTINNode.bFromSurface == true) { zVal = pSurface.GetElevation(mapPoint); if (double.IsNaN(zVal)) { zVal = 0; } frmAddTINNode.SetdoubleInputHeightValue(zVal); } else { zVal = frmAddTINNode.dHeight; if (double.IsNaN(zVal)) { zVal = 0; } } mapPoint.Z = zVal; pAddedPoint = mapPoint; } //在layout控件操作取不到z值 else { IPageLayoutControl pLayoutCtr = (((IToolbarControl)m_hookHelper.Hook).Buddy) as IPageLayoutControl; //if (pLayoutCtr.ActiveView.FocusMap.Equals(pMap)) IPoint mapPoint = pLayoutCtr.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y); IZAware za = mapPoint as IZAware; za.ZAware = true; double zVal; if (frmAddTINNode.bFromSurface == true) { zVal = pSurface.GetElevation(mapPoint); if (double.IsNaN(zVal)) { zVal = 0; } frmAddTINNode.SetdoubleInputHeightValue(zVal); } else { zVal = frmAddTINNode.dHeight; if (double.IsNaN(zVal)) { zVal = 0; } } mapPoint.Z = zVal; pAddedPoint = mapPoint; } }
public void SetPageLayoutSize(IPageLayoutControl vPagelayout, double dblPageWidth, double dblPageHeight, double dblDataFrameWidth, double dblDataFrameHeight) { }
public override void OnMouseUp(int Button, int Shift, int X, int Y) { if (m_InUse == false) { return; } if (GetCapture() == m_HookHelper.ActiveView.ScreenDisplay.hWnd) { ReleaseCapture(); } if (m_Feedback == null) { m_Feedback = null; m_InUse = false; return; } IEnvelope envelope = m_Feedback.Stop(); if ((envelope.IsEmpty) || (envelope.Width == 0) || (envelope.Height == 0)) { m_Feedback = null; m_InUse = false; return; } frmSymbolSelector symbolForm = new frmSymbolSelector(); IStyleGalleryItem styleGalleryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassNorthArrows, null); symbolForm.Dispose(); if (symbolForm.DialogResult != DialogResult.OK) { return; } if (styleGalleryItem == null) { return; } IMapFrame mapFrame = (IMapFrame)m_HookHelper.ActiveView.GraphicsContainer.FindFrame(m_HookHelper.ActiveView.FocusMap); UID vUid = new UIDClass(); vUid.Value = "{7A3F91DD-B9E3-11d1-8756-0000F8751720}"; IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(vUid, (IMapSurround)styleGalleryItem.Item); IElement element = (IElement)mapSurroundFrame; element.Geometry = envelope; IElementProperties3 pep = element as IElementProperties3; pep.Name = "指北针"; IGraphicsContainerSelect pGraphicsSel = m_HookHelper.ActiveView.GraphicsContainer as IGraphicsContainerSelect; pGraphicsSel.UnselectAllElements(); pGraphicsSel.SelectElement(element); m_HookHelper.ActiveView.GraphicsContainer.AddElement(element, 0); m_HookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); if (m_HookHelper.Hook is IPageLayoutControl) { IPageLayoutControl pPLC = m_HookHelper.Hook as IPageLayoutControl; if (pPLC != null) { ////初始化控件工具为选择元素工具 //string progID = "esriControls.ControlsSelectTool"; //int index = axToolbarControl1.Find(progID); //if (index != -1) //{ // IToolbarItem toolItem = axToolbarControl1.GetItem(index); // ICommand _cmd = toolItem.Command; // ITool _tool = (ITool)_cmd; // pPLC.CurrentTool = _tool; //} } } m_Feedback = null; m_InUse = false; }
public void OnClick(int EditMode) { m_pAV = m_pHookHelper.ActiveView; IViewManager pViewManager = (IViewManager)m_pAV; IEnumElement pEnumElement = (IEnumElement)pViewManager.ElementSelection; pEnumElement.Reset(); IElement pElement = pEnumElement.Next(); if (pElement == null) { return; } int i = 0; while (pElement != null) { i++; pElement = pEnumElement.Next(); if (i > 1) { return; } } pEnumElement.Reset(); pElement = pEnumElement.Next(); if (pElement is IMapSurroundFrame) { IMapSurroundFrame pMapSFrame = (IMapSurroundFrame)pElement; if (pMapSFrame.MapSurround is ILegend) { frmAddLegend vFrmLegend = new frmAddLegend(false); vFrmLegend.SetMapSurroundFrame(pMapSFrame); return; } } IPageLayoutControl pPageLayoutControl = null; if (EditMode == 1) { if (m_pHookHelper.Hook is IToolbarControl) { IToolbarControl pToolBarControl = m_pHookHelper.Hook as IToolbarControl; if (pToolBarControl.Buddy is IPageLayoutControl) { pPageLayoutControl = pToolBarControl.Buddy as IPageLayoutControl; } } else if (m_pHookHelper.Hook is IPageLayoutControl) { pPageLayoutControl = m_pHookHelper.Hook as IPageLayoutControl; } } frmElementProperty frm = new frmElementProperty(EditMode); frm.set_PageLayoutControl = pPageLayoutControl; frm.StartEditElement(m_pAV, ref pElement); frm.ShowDialog(); frm.Dispose(); }