private IElement GetSelectedPointElement() { IMap activeFrame = m_hookHelper.FocusMap; IGraphicsContainerSelect graphicsSel = activeFrame as IGraphicsContainerSelect; IElement selectedElement = null; IAGAnimationType graphicAnimationType = new AnimationTypeMapGraphic(); if (graphicsSel.ElementSelectionCount > 0) { IEnumElement enumElem = graphicsSel.SelectedElements; selectedElement = enumElem.Next(); while (selectedElement != null) { if (graphicAnimationType.get_AppliesToObject(selectedElement)) { break; } selectedElement = enumElem.Next(); } } else { selectedElement = null; } return(selectedElement); }
private void FrmNeatLine_Load(object sender, EventArgs e) { IGraphicsContainer pGraphicsContainer = m_hookHelper.ActiveView.GraphicsContainer; IGraphicsContainerSelect pGraphicsContainerSelect = pGraphicsContainer as IGraphicsContainerSelect; int SelectElementCount = pGraphicsContainerSelect.ElementSelectionCount; if (SelectElementCount != 0) { this.cBoxSelectElementFrame.Checked = true; } else { this.cBoxPageFrame.Checked = true; } //FrmFrameBorder Frmborder = new FrmFrameBorder(SymbolBorder); //if (SymbolBorder != null) //{ // btBorder.Image = Frmborder.GetImageByGiveSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassBorders,SymbolBorder, btBorder.Width - 14, btBorder.Height - 14); //} //FrmFrameBackground Frmbackground = new FrmFrameBackground(SymbolBackground); //if (SymbolBackground != null) //{ // btBackground.Image = Frmbackground.GetImageByGiveSymbolBeforeSelectItem(esriSymbologyStyleClass .esriStyleClassBackgrounds,SymbolBackground ,btBackground .Width -14,btBackground .Height -14); //} //FrmFrameShadow Frmshadow = new FrmFrameShadow(SymbolShadow); //if (SymbolShadow != null) //{ // btShadow.Image = Frmshadow.GetImageByGiveSymbolBeforeSelectItem(esriSymbologyStyleClass .esriStyleClassShadows,SymbolShadow ,btShadow .Width -14,btShadow.Height -14); //} }
public override void OnClick() { IGraphicsContainer graphicsContainer = this._context.ActiveView.GraphicsContainer; IGraphicsContainerSelect graphicsContainerSelect = graphicsContainer as IGraphicsContainerSelect; IEnumElement selectedElements = graphicsContainerSelect.SelectedElements; MapTemplateGroupElement mapTemplateGroupElement = new MapTemplateGroupElement(MapTemplate.CurrentMapTemplate); mapTemplateGroupElement.Create(selectedElements); mapTemplateGroupElement.Save(); List <IElement> list = new List <IElement>(); selectedElements.Reset(); for (IElement element = selectedElements.Next(); element != null; element = selectedElements.Next()) { list.Add(element); } foreach (IElement current in list) { graphicsContainer.DeleteElement(current); } IGraphicsContainer graphicsContainer2 = this._context.ActiveView.GraphicsContainer; IElement element2 = mapTemplateGroupElement.GetElement(this._context.ActiveView as IPageLayout); graphicsContainer2.AddElement(element2, -1); this._context.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element2, null); }
/// <summary> /// 插入线标记 并且将线标记移动到后面 /// </summary> /// <param name="mapControl"></param> /// <param name="pGeometry"></param> /// <returns></returns> public static IElement DrawLineSymbol(AxMapControl mapControl, IGeometry pGeometry) { IRgbColor pColor = GetColor(0, 255, 255); pColor.Transparency = 255; //产生一个线符号对象 ILineSymbol pOutline = new SimpleLineSymbolClass(); pOutline.Width = 4; pOutline.Color = pColor; ILineElement pLineElement = new LineElementClass(); pLineElement.Symbol = pOutline; IElement pElement = pLineElement as IElement; pElement.Geometry = pGeometry; //添加标注 InsertElement(mapControl, pElement, 0); IGraphicsContainerSelect tmpGSelect = (IGraphicsContainerSelect)mapControl.Map; //将元素移动到后面 tmpGSelect.SelectElement(pElement); IGraphicsContainer pGraphicsContainer = mapControl.Map as IGraphicsContainer; pGraphicsContainer.SendToBack(tmpGSelect.SelectedElements); tmpGSelect.UnselectAllElements(); return(pElement); }
private void method_0() { IGraphicsContainer graphicsContainer = this.iactiveView_0.GraphicsContainer; IGraphicsContainerSelect graphicsContainerSelect = graphicsContainer as IGraphicsContainerSelect; graphicsContainerSelect.UnselectAllElements(); this.ienumElement_0.Reset(); IElement element = this.ienumElement_0.Next(); this.ilist_0.Clear(); while (element != null) { if ((!(element is IGraphicsComposite) ? false : !(element is IMapFrame))) { IEnumElement graphics = (element as IGraphicsComposite).Graphics[this.iactiveView_0.ScreenDisplay, null]; graphics.Reset(); for (IElement i = graphics.Next(); i != null; i = graphics.Next()) { graphicsContainer.AddElement(i, -1); graphicsContainerSelect.SelectElement(element); this.ilist_0.Add(i); } } element = this.ienumElement_0.Next(); } foreach (IElement list0 in this.list_0) { graphicsContainer.DeleteElement(list0); } }
private void GroupElement(IGraphicsContainer pGC, IEnvelope pEnvelop) { IGroupElement2 groupElementClass = null; IGraphicsContainerSelect graphicsContainerSelect = pGC as IGraphicsContainerSelect; IEnumElement selectedElements = graphicsContainerSelect.SelectedElements; selectedElements.Reset(); IElement i = selectedElements.Next(); if (groupElementClass == null) { groupElementClass = new GroupElement() as IGroupElement2; (groupElementClass as IElement).Geometry = pEnvelop; while (i != null) { groupElementClass.AddElement(i); groupElementClass.Refresh(); i = selectedElements.Next(); } } pGC.AddElement(groupElementClass as IElement, -1); (groupElementClass as IElement).QueryBounds((pGC as IActiveView).ScreenDisplay, pEnvelop); selectedElements.Reset(); for (i = selectedElements.Next(); i != null; i = selectedElements.Next()) { pGC.DeleteElement(i); } graphicsContainerSelect.SelectElement(groupElementClass as IElement); }
private void method_0() { IGraphicsContainer graphicsContainer = this.iactiveView_0.GraphicsContainer; IGraphicsContainerSelect graphicsContainerSelect = graphicsContainer as IGraphicsContainerSelect; this.ienumElement_0.Reset(); IElement element = this.ienumElement_0.Next(); List <IElement> elements = new List <IElement>(); if (this.igroupElement2_0 == null) { this.igroupElement2_0 = new GroupElement() as IGroupElement2; while (element != null) { this.igroupElement2_0.AddElement(element); elements.Add(element); element = this.ienumElement_0.Next(); } } for (int i = 0; i < elements.Count; i++) { graphicsContainer.DeleteElement(elements[i]); } graphicsContainer.AddElement(this.igroupElement2_0 as IElement, -1); graphicsContainerSelect.SelectElement(this.igroupElement2_0 as IElement); }
private IEnvelope method_3(IGraphicsContainerSelect igraphicsContainerSelect_0) { try { IEnumElement selectedElements = igraphicsContainerSelect_0.SelectedElements; selectedElements.Reset(); IEnvelope envelope = null; IEnvelope inEnvelope = null; for (IElement element2 = selectedElements.Next(); element2 != null; element2 = selectedElements.Next()) { if (envelope == null) { envelope = element2.Geometry.Envelope; } else { inEnvelope = element2.Geometry.Envelope; envelope.Union(inEnvelope); } } if ((envelope != null) && ((envelope.Width == 0.0) || (envelope.Height == 0.0))) { envelope.Expand(0.001, 0.001, false); return(envelope); } } catch (Exception) { } return(null); }
public bool FocusOneElement(IPageLayout ipageLayout_0, IElement ielement_0) { bool result; try { IGraphicsContainerSelect graphicsContainerSelect = ipageLayout_0 as IGraphicsContainerSelect; if (graphicsContainerSelect == null) { result = false; return(result); } IActiveView activeView = ipageLayout_0 as IActiveView; activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphicSelection, null, null); int elementSelectionCount = graphicsContainerSelect.ElementSelectionCount; if (elementSelectionCount >= 1) { graphicsContainerSelect.UnselectAllElements(); } graphicsContainerSelect.SelectElement(ielement_0); activeView.Refresh(); result = true; return(result); } catch { } result = false; return(result); }
private void method_0() { this.ienumElement_0.Reset(); IElement element = this.ienumElement_0.Next(); IGraphicsContainer graphicsContainer = this.iactiveView_0.GraphicsContainer; IGraphicsContainerSelect graphicsContainerSelect = graphicsContainer as IGraphicsContainerSelect; graphicsContainerSelect.UnselectAllElements(); graphicsContainer.DeleteElement(element); while (element != null) { if (element is IGroupElement) { IEnumElement elements = (element as IGroupElement).Elements; elements.Reset(); for (IElement i = elements.Next(); i != null; i = elements.Next()) { (element as IElementProperties2).AutoTransform = true; graphicsContainer.AddElement(i, -1); graphicsContainerSelect.SelectElement(i); } } element = this.ienumElement_0.Next(); } }
private void method_4(IGraphicsContainer igraphicsContainer_0, IEnvelope ienvelope_0) { IGroupElement2 element = null; IGraphicsContainerSelect select = igraphicsContainer_0 as IGraphicsContainerSelect; IEnumElement selectedElements = select.SelectedElements; selectedElements.Reset(); IElement element3 = selectedElements.Next(); element = new GroupElementClass(); (element as IElement).Geometry = ienvelope_0; while (element3 != null) { element.AddElement(element3); element.Refresh(); element3 = selectedElements.Next(); } igraphicsContainer_0.AddElement(element as IElement, -1); (element as IElement).QueryBounds((igraphicsContainer_0 as IActiveView).ScreenDisplay, ienvelope_0); selectedElements.Reset(); for (element3 = selectedElements.Next(); element3 != null; element3 = selectedElements.Next()) { igraphicsContainer_0.DeleteElement(element3); } select.SelectElement(element as IElement); }
public void CaptureProperties(IAGAnimationContainer pContainer, object pObject) { IElement elem = pObject as IElement; IActiveView view = pContainer.CurrentView as IActiveView; IGraphicsContainerSelect graphicsConSel = view as IGraphicsContainerSelect; IDisplay disp = view.ScreenDisplay as IDisplay; IEnvelope elemEnv = GetElementBound(elem, pContainer); if (elem.Geometry.GeometryType == esriGeometryType.esriGeometryPoint) { Position = elem.Geometry as IPoint; } else { IEnvelope elementEnvelope = elem.Geometry.Envelope; IArea elementArea = elementEnvelope as IArea; Position = elementArea.Centroid; } IElementProperties elemProps = (IElementProperties)elem; if (elemProps.CustomProperty != null) { Rotation = (double)elemProps.CustomProperty; } }
public bool AddElement(IGraphicsContainer pGraphicsContainer, IElement pElement, bool bSelect, bool bPreserve) { try { if (pGraphicsContainer == null) { return(false); } if (pElement == null) { return(false); } pGraphicsContainer.AddElement(pElement, 0); if (bSelect && (pGraphicsContainer is IGraphicsContainerSelect)) { IGraphicsContainerSelect select = pGraphicsContainer as IGraphicsContainerSelect; if (!bPreserve) { select.UnselectAllElements(); } select.SelectElement(pElement); } return(true); } catch (Exception exception) { this.mErrOpt.ErrorOperate(this.mSubSysName, "FunFactory.ElementFun", "AddElement", exception.GetHashCode().ToString(), exception.Source, exception.Message, "", "", ""); return(false); } }
//private void GetLongLat(float jing, float wei, out float Long, float lat) //{ //} private void GotoXY_Load(object sender, EventArgs e) { activeview = pAxMapControl.Map as IActiveView; map = activeview.FocusMap; pScreenDisplay = activeview.ScreenDisplay; pGraphicsContainer = map as IGraphicsContainer; IGraphicsContainerSelect pGraphconSel = map as IGraphicsContainerSelect; }
private void method_0() { IElement element2; IGraphicsContainerSelect select = this.ipageLayout_0 as IGraphicsContainerSelect; if (select.ElementSelectionCount > 0) { this.rdoPlaceSelectElement.Enabled = true; this.rdoPlaceSelectElement.Checked = true; this.rdoPlaceAllElement.Checked = false; this.rdoPlacePageMargine.Checked = false; IEnumElement selectedElements = select.SelectedElements; selectedElements.Reset(); element2 = selectedElements.Next(); if ((select.ElementSelectionCount == 1) && (element2 is IFrameElement)) { this.chkNewFrameElement.Checked = false; this.chkNewFrameElement.Enabled = true; this.chkGroup.Checked = false; this.chkGroup.Enabled = false; this.iframeElement_0 = element2 as IFrameElement; this.method_1(element2 as IFrameElement); } else { this.chkNewFrameElement.Checked = true; this.chkNewFrameElement.Enabled = false; this.chkGroup.Checked = false; this.chkGroup.Enabled = true; } } else { this.rdoPlaceSelectElement.Enabled = false; this.rdoPlaceSelectElement.Checked = false; this.rdoPlaceAllElement.Checked = true; this.rdoPlacePageMargine.Checked = false; IGraphicsContainer container = this.ipageLayout_0 as IGraphicsContainer; container.Reset(); element2 = container.Next(); if (!((container.Next() == null) && (element2 is IFrameElement))) { this.chkNewFrameElement.Checked = true; this.chkNewFrameElement.Enabled = false; this.chkGroup.Checked = false; this.chkGroup.Enabled = true; } else { this.chkNewFrameElement.Checked = false; this.chkNewFrameElement.Enabled = true; this.chkGroup.Checked = false; this.chkGroup.Enabled = false; this.iframeElement_0 = element2 as IFrameElement; this.method_1(element2 as IFrameElement); } } }
private void AddNormalTextElement(IPoint pPoint) { IGraphicsContainer pGraphicCtn = m_pAV.GraphicsContainer; try { frmEdit frmCallOut = new frmEdit(false); PublicClass.POINTAPI pos = new PublicClass.POINTAPI(); PublicClass.GetCursorPos(ref pos); int scrW = Screen.PrimaryScreen.Bounds.Width; //主显示宽度 int scrH = Screen.PrimaryScreen.Bounds.Height; //主显示高度 frmCallOut.Location = new System.Drawing.Point(pos.x, pos.y); // * pScreen.BitsPerPixel if (pos.x + frmCallOut.Width > scrW && pos.y + frmCallOut.Height > scrH) //超出显示器边界宽和高,则迂回 { frmCallOut.Location = new System.Drawing.Point(scrW - frmCallOut.Width, scrH - frmCallOut.Height); } if (pos.x + frmCallOut.Width > scrW && pos.y + frmCallOut.Height < scrH) //超出显示器边界宽,则迂回 { frmCallOut.Location = new System.Drawing.Point(scrW - frmCallOut.Width, pos.y); } if (pos.x + frmCallOut.Width < scrW && pos.y + frmCallOut.Height > scrH) //超出显示器边界高,则迂回 { frmCallOut.Location = new System.Drawing.Point(pos.x, scrH - frmCallOut.Height); } frmCallOut.ShowDialog(); if (frmCallOut.DialogResult == System.Windows.Forms.DialogResult.Cancel) { return; } ITextElement pTextElement = new TextElementClass(); pTextElement.ScaleText = true; pTextElement.Text = frmCallOut.AnnoText; IFormattedTextSymbol pTextSymbol = (IFormattedTextSymbol)frmCallOut.m_pTextSymbol; pTextElement.Symbol = pTextSymbol as ITextSymbol; IElement pElement = (IElement)pTextElement; pElement.Geometry = pPoint; //刷新显示 frmCallOut.Dispose(); IGraphicsContainerSelect pGraphicsSel = pGraphicCtn as IGraphicsContainerSelect; pGraphicsSel.UnselectAllElements(); pGraphicsSel.SelectElement(pElement); pGraphicCtn.AddElement(pElement, 0); m_pAV.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("添加文本注记失败:" + ex.Message, "提示"); return; } }
public override void OnClick() { IGraphicsContainer graphicsContainer = this._context.ActiveView.GraphicsContainer; IGraphicsContainerSelect graphicsContainerSelect = graphicsContainer as IGraphicsContainerSelect; IUnGroupElementOperation unGroupElementOperation = new UnGroupElementOperation(); unGroupElementOperation.ActiveView = this._context.ActiveView; unGroupElementOperation.Elements = graphicsContainerSelect.SelectedElements; this._context.OperationStack.Do(unGroupElementOperation); this._context.ActiveView.Refresh(); }
public void CopyMapToPageLayOutDataFrameforPrint(IMap MapControlOfMap) { this.m_OldMap = MapControlOfMap; IGraphicsContainerSelect graphicsContainer = this.axPageLayoutControl1.ActiveView.GraphicsContainer as IGraphicsContainerSelect; IElement element = null; IMapFrame frame = null; if (graphicsContainer.ElementSelectionCount <= 0) { this.CopyMapToPageLayOutforPrint(MapControlOfMap); } else { for (int i = 0; i < graphicsContainer.ElementSelectionCount; i++) { element = graphicsContainer.SelectedElement(i); if (element is IMapFrame) { frame = element as IMapFrame; break; } } if (frame != null) { SimpleLineSymbolClass class2 = new SimpleLineSymbolClass(); IRgbColor color = new RgbColorClass { Red = 255, Green = 255, Blue = 255 }; class2.Color = color; ISymbolBorder border = new SymbolBorderClass { LineSymbol = class2 }; frame.Border = border; IObjectCopy copy = new ObjectCopyClass(); object pInObject = MapControlOfMap; object obj3 = copy.Copy(pInObject); object map = frame.Map; copy.Overwrite(obj3, ref map); this.fullPageLayerOut(this.axPageLayoutControl1.ActiveView.FocusMap, (MapControlOfMap as IActiveView).Extent); this.axPageLayoutControl1.ActiveView.Refresh(); } else { this.CopyMapToPageLayOutforPrint(MapControlOfMap); } } }
private void delete_ele_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { IGraphicsContainerSelect pGraphicsCSelect = this.axPageLayoutControl1.GraphicsContainer as IGraphicsContainerSelect; IEnumElement pEnumEle = pGraphicsCSelect.SelectedElements; IElement ele = pEnumEle.Next(); while (ele != null) { this.axPageLayoutControl1.GraphicsContainer.DeleteElement(ele); this.axPageLayoutControl1.Refresh(); ele = pEnumEle.Next(); } }
public override void OnClick() { IGraphicsContainer graphicsContainer = this._context.ActiveView.GraphicsContainer; IGraphicsContainerSelect graphicsContainerSelect = graphicsContainer as IGraphicsContainerSelect; IEnumElement selectedElements = graphicsContainerSelect.SelectedElements; IGroupElementOperation groupElementOperation = new GroupElementOperation(); groupElementOperation.ActiveView = this._context.ActiveView; groupElementOperation.Elements = selectedElements; this._context.OperationStack.Do(groupElementOperation); this._context.ActiveView.Refresh(); //DocumentManager.DocumentChanged(this._context.Hook); }
public void Undo() { IGraphicsContainer graphicsContainer = this.iactiveView_0.GraphicsContainer; IGraphicsContainerSelect graphicsContainerSelect = graphicsContainer as IGraphicsContainerSelect; graphicsContainerSelect.UnselectAllElements(); graphicsContainer.DeleteElement(this.igroupElement2_0 as IElement); this.ienumElement_0.Reset(); for (IElement i = this.ienumElement_0.Next(); i != null; i = this.ienumElement_0.Next()) { graphicsContainer.AddElement(i, -1); graphicsContainerSelect.SelectElement(i); } }
private IEnvelope GetElementBound(IElement elem, IAGAnimationContainer pContainer) { IActiveView view = pContainer.CurrentView as IActiveView; IGraphicsContainerSelect graphicsContainerSelect = view as IGraphicsContainerSelect; IDisplay disp = view.ScreenDisplay as IDisplay; IEnvelope elementEnvelope = new EnvelopeClass(); elem.QueryBounds(disp, elementEnvelope); if (graphicsContainerSelect.ElementSelected(elem)) { elementEnvelope = elem.SelectionTracker.get_Bounds(disp); } return(elementEnvelope); }
/// <summary> /// 改变要素属性 /// </summary> /// <returns></returns> public bool ChangeElement(object sender, IPageLayoutControlEvents_OnDoubleClickEvent e) { IGraphicsContainer pGraphicsCon; pGraphicsCon = this.mainPage.PageLayout as IGraphicsContainer; pGraphicsCon.Reset(); IGraphicsContainerSelect pGraSelect = this.mainPage.PageLayout as IGraphicsContainerSelect; IElement pElement = pGraSelect.SelectedElement(0); IMapSurroundFrame pMapSurroundFrame = null; if (pElement is IMapSurroundFrame) { pMapSurroundFrame = pElement as IMapSurroundFrame; } IGeometry geo = pElement.Geometry; # region 文本 if (pElement is ITextElement)
private void OnActiveViewEventsSelectionChanged() { m_CompoLyr = this.axMapControl1.Map.ActiveGraphicsLayer as ICompositeLayer; for (int i = 0; i < m_CompoLyr.Count; i++) { IGraphicsLayer m_GraphicsLyr = (IGraphicsLayer)m_CompoLyr.Layer[i]; IGraphicsContainerSelect m_GConatinerSelect = m_GraphicsLyr as IGraphicsContainerSelect; if (m_GConatinerSelect.ElementSelectionCount != 1) { //MessageBox.Show("Select only one graphic element"); } else { IElement m_Element = (IElement)m_GConatinerSelect.SelectedElements.Next(); if (m_Element is ITextElement) { if (this.m_Form_LabelEdit == null) { m_Form_LabelEdit = new Form_LabelEdit(); m_Form_LabelEdit.m_ActiveView = this.axMapControl1.ActiveView; m_Form_LabelEdit.m_TextElement = (ITextElement)m_Element; m_Form_LabelEdit.Show(); } else { m_Form_LabelEdit = new Form_LabelEdit(); m_Form_LabelEdit.m_ActiveView = this.axMapControl1.ActiveView; m_Form_LabelEdit.m_TextElement = (ITextElement)m_Element; m_Form_LabelEdit.Show(); } } } this.axMapControl1.ActiveView.Refresh(); } }
/// <summary> /// Occurs when this command is clicked /// </summary> public override void OnClick() { // TODO: Add CmdDelectSelElement.OnClick implementation IGraphicsContainer pGraphicsContainer = m_hookHelper.ActiveView.GraphicsContainer; IGraphicsContainerSelect pGraphicsContainerSelect = pGraphicsContainer as IGraphicsContainerSelect; int SelectElementCount = pGraphicsContainerSelect.ElementSelectionCount; IEnumElement pEnumElement = pGraphicsContainerSelect.SelectedElements; pEnumElement.Reset(); IElement pElement = pEnumElement.Next(); for (int i = 0; i < SelectElementCount; i++) { pGraphicsContainer.DeleteElement(pElement); pElement = pEnumElement.Next(); m_hookHelper.ActiveView.Refresh(); } }
public static void FocusOneElement(IActiveView iactiveView_0, IElement ielement_0) { try { IGraphicsContainerSelect iactiveView0 = iactiveView_0 as IGraphicsContainerSelect; if (iactiveView0 != null) { iactiveView_0.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); if (iactiveView0.ElementSelectionCount >= 1) { iactiveView0.UnselectAllElements(); } iactiveView0.SelectElement(ielement_0); iactiveView_0.PartialRefresh(esriViewDrawPhase.esriViewGraphics, ielement_0, null); } } catch { } }
public void Undo() { IGraphicsContainer graphicsContainer = this.iactiveView_0.GraphicsContainer; IGraphicsContainerSelect graphicsContainerSelect = graphicsContainer as IGraphicsContainerSelect; graphicsContainerSelect.UnselectAllElements(); for (int i = 0; i < this.ilist_0.Count; i++) { graphicsContainer.DeleteElement(this.ilist_0[i] as IElement); } this.ienumElement_0.Reset(); for (IElement j = this.ienumElement_0.Next(); j != null; j = this.ienumElement_0.Next()) { if ((!(j is IGraphicsComposite) ? false : !(j is IMapFrame))) { graphicsContainer.AddElement(j, -1); graphicsContainerSelect.SelectElement(j); } } }
private void MainForm_Load(object sender, EventArgs e) { if (!ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.ArcReader)) { if (!ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop)) { MessageBox.Show("Unable to bind to ArcGIS runtime. Application will be shut down."); return; } } //get the MapControl m_mapControl = (IMapControl3)axMapControl1.Object; //disable the Save menu (since there is no document yet) menuSaveDoc.Enabled = false; activeview = axMapControl1.Map as IActiveView; map = activeview.FocusMap; pScreenDisplay = activeview.ScreenDisplay; pGraphicsContainer = map as IGraphicsContainer; IGraphicsContainerSelect pGraphconSel = map as IGraphicsContainerSelect; }
private void rdoPlaceSelectElement_CheckedChanged(object sender, EventArgs e) { if (this.bool_0) { IGraphicsContainerSelect select = this.ipageLayout_0 as IGraphicsContainerSelect; IEnumElement selectedElements = select.SelectedElements; selectedElements.Reset(); IElement element2 = selectedElements.Next(); if ((select.ElementSelectionCount == 1) && (element2 is IFrameElement)) { this.chkNewFrameElement.Enabled = true; this.chkGroup.Enabled = this.chkNewFrameElement.Checked; this.chkGroup.Checked = false; } else { this.chkNewFrameElement.Checked = true; this.chkNewFrameElement.Enabled = false; this.chkGroup.Enabled = true; } } }
private ILineElement GetSelectedLineElement() { IMap activeFrame = m_hookHelper.FocusMap; IGraphicsContainerSelect graphicsSel = activeFrame as IGraphicsContainerSelect; IElement selectedElement = null; ILineElement lineElement; if (graphicsSel.ElementSelectionCount > 0) { IEnumElement enumElem = graphicsSel.SelectedElements; selectedElement = enumElem.Next(); while (selectedElement != null) { if (selectedElement is ILineElement) { break; } selectedElement = enumElem.Next(); } } lineElement = (ILineElement)selectedElement; return(lineElement); }