private ISymbol GetSymbolByControl(ISymbol symbolType) { ISymbol symbol = null; IStyleGalleryItem styleGalleryItem = null; esriSymbologyStyleClass styleClass = esriSymbologyStyleClass. esriStyleClassMarkerSymbols; if (symbolType is IMarkerSymbol) { styleClass = esriSymbologyStyleClass.esriStyleClassMarkerSymbols; } if (symbolType is ILineSymbol) { styleClass = esriSymbologyStyleClass.esriStyleClassLineSymbols; } if (symbolType is IFillSymbol) { styleClass = esriSymbologyStyleClass.esriStyleClassFillSymbols; } GetSymbol symbolForm = new GetSymbol(styleClass); symbolForm.ShowDialog(); styleGalleryItem = symbolForm.m_styleGalleryItem; if (styleGalleryItem == null) { return(null); } symbol = styleGalleryItem.Item as ISymbol; symbolForm.Dispose(); this.Activate(); return(symbol); }
public override void OnMouseDown(int Button, int Shift, int X, int Y) { // TODO: Add AddScaleBar.OnMouseDown implementation if (Button == 1) { IEnvelope pEnv; pEnv = pPageLayoutControl.TrackRectangle(); GetSymbol symbolForm = new GetSymbol(esriSymbologyStyleClass. esriStyleClassScaleBars); symbolForm.Text = "Choose Scale Bar"; IStyleGalleryItem styleGalleryItem = symbolForm.GetItem (esriSymbologyStyleClass.esriStyleClassNorthArrows); symbolForm.Dispose(); if (styleGalleryItem == null) { return; } IMapFrame mapFrame = (IMapFrame)m_hookHelper.ActiveView.GraphicsContainer. FindFrame(m_hookHelper.ActiveView.FocusMap); IMapSurroundFrame mapSurroundFrame = new MapSurroundFrameClass(); mapSurroundFrame.MapFrame = mapFrame; mapSurroundFrame.MapSurround = (IMapSurround)styleGalleryItem.Item; IElement element = (IElement)mapSurroundFrame; element.Geometry = pEnv; m_hookHelper.ActiveView.GraphicsContainer.AddElement ((IElement)mapSurroundFrame, 0); m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, mapSurroundFrame, null); } }
public override void OnMouseUp(int Button, int Shift, int X, int Y) { // TODO: Add AddNortharrow.OnMouseUp implementation 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; } GetSymbol symbolForm = new GetSymbol(esriSymbologyStyleClass. esriStyleClassNorthArrows); symbolForm.Text = "Choose North Arrow"; IStyleGalleryItem styleGalleryItem = symbolForm.GetItem(esriSymbologyStyleClass. esriStyleClassNorthArrows); symbolForm.Dispose(); if (styleGalleryItem == null) { return; } IMapFrame mapFrame = (IMapFrame)m_hookHelper.ActiveView.GraphicsContainer. FindFrame(m_hookHelper.ActiveView.FocusMap); IMapSurroundFrame mapSurroundFrame = new MapSurroundFrameClass(); mapSurroundFrame.MapFrame = mapFrame; mapSurroundFrame.MapSurround = (IMapSurround)styleGalleryItem.Item; IElement element = (IElement)mapSurroundFrame; element.Geometry = envelope; m_hookHelper.ActiveView.GraphicsContainer.AddElement ((IElement)mapSurroundFrame, 0); m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, mapSurroundFrame, null); m_Feedback = null; m_InUse = false; }
private void btnSelectColorRamp_Click(object sender, EventArgs e) { GetSymbol symbolForm = new GetSymbol(esriSymbologyStyleClass.esriStyleClassColorRamps); symbolForm.ShowDialog(); IStyleGalleryItem styleGalleryItem = symbolForm.m_styleGalleryItem; if (styleGalleryItem == null) { return; } colorRamp = styleGalleryItem.Item as IColorRamp; symbolForm.Dispose(); }