zoukankan      html  css  js  c++  java
  • ArcEngine 绘图

    画点 [C#] public void OnMouseDown(int Button, int Shift, int X, int Y) { IMxDocument mxDoc = m_App.Document as IMxDocument; IActiveView activeView = mxDoc.FocusMap as IActiveView; IScreenDisplay screenDisplay = activeView.ScreenDisplay; screenDisplay.StartDrawing(screenDisplay.hDC, (short)  esriScreenCache.esriNoScreenCache); screenDisplay.SetSymbol(new SimpleMarkerSymbolClass()); screenDisplay.DrawPoint(mxDoc.CurrentLocation); screenDisplay.FinishDrawing(); } 画线 public void OnMouseDown(int Button, int Shift, int X, int Y) { IMxDocument mxDoc = m_App.Document as IMxDocument; IActiveView activeView = mxDoc.FocusMap as IActiveView; IScreenDisplay screenDisplay = activeView.ScreenDisplay; ISimpleLineSymbol lineSymbol = new SimpleLineSymbolClass(); IRgbColor rgbColor = new RgbColorClass(); rgbColor.Red = 255; lineSymbol.Color = rgbColor; IRubberBand rubberLine = new RubberLineClass(); IPolyline newPolyline = (IPolyline)rubberLine.TrackNew(screenDisplay, (ISymbol)lineSymbol); screenDisplay.StartDrawing(screenDisplay.hDC, (short)esriScreenCache.esriNoScreenCache); screenDisplay.SetSymbol((ISymbol)lineSymbol); screenDisplay.DrawPolyline(newPolyline); screenDisplay.FinishDrawing(); } 画线2 { ICartographicLineSymbol pCartoLineSyl; pCartoLineSyl = new CartographicLineSymbolClass(); pCartoLineSyl.Color = getRGB(255, 110, 210); pCartoLineSyl.Cap = esriLineCapStyle.esriLCSButt; pCartoLineSyl.Join = esriLineJoinStyle.esriLJSBevel; pCartoLineSyl.Width=4; pCartoLineSyl.MiterLimit=4; ILineProperties pLinePro ; pLinePro = pCartoLineSyl as ILineProperties;//取地址 ISimpleLineDecorationElement pSimpleLineDecoEle; pSimpleLineDecoEle = new SimpleLineDecorationElementClass(); pSimpleLineDecoEle.FlipAll = true; pSimpleLineDecoEle.FlipFirst = true; ILineDecoration pLineDeco; pLineDeco = new LineDecorationClass(); pLineDeco.AddElement(pSimpleLineDecoEle); pLinePro.LineDecoration = pLineDeco; pLinePro.DecorationOnTop=true; IGeometry pGeo; pGeo = axMapControl2.TrackLine(); object oLineSymbol = pCartoLineSyl; axMapControl2.DrawShape(pGeo, ref oLineSymbol); } 画线3 private void axMapControl2_OnMouseDown(object sender, AxESRI.ArcGIS.MapControl.IMapControlEvents2_OnMouseDownEvent e) { //                        ISimpleLineSymbol pLineSyl; //                                pLineSyl = new SimpleLineSymbolClass(); //                                pLineSyl.Color = getRGB(30, 60, 90); //                                pLineSyl.Width = 4; //                                pLineSyl.Style = esriSimpleLineStyle.esriSLSDashDot; ICartographicLineSymbol pCartoLineSyl; pCartoLineSyl = new CartographicLineSymbolClass(); //pCartoLineSyl.Color = getRGB(255, 110, 210); pCartoLineSyl.Cap = esriLineCapStyle.esriLCSButt; pCartoLineSyl.Join = esriLineJoinStyle.esriLJSBevel; pCartoLineSyl.Width=10; pCartoLineSyl.MiterLimit=4; ILineProperties pLinePro ; pLinePro = pCartoLineSyl as ILineProperties;//取地址 ISimpleLineDecorationElement pSimpleLineDecoEle; pSimpleLineDecoEle = new SimpleLineDecorationElementClass(); pSimpleLineDecoEle.FlipAll = true; pSimpleLineDecoEle.FlipFirst = true; ILineDecoration pLineDeco; pLineDeco = new LineDecorationClass(); pLineDeco.AddElement(pSimpleLineDecoEle); pLinePro.LineDecoration = pLineDeco; pLinePro.DecorationOnTop=true; ILineFillSymbol pLineFillSymbol =new LineFillSymbolClass(); pLineFillSymbol.Offset=3; pLineFillSymbol.Angle=45; pLineFillSymbol.Offset=10; IFillSymbol pFillSymbol =pLineFillSymbol as IFillSymbol; pFillSymbol.Color=getRGB(0,0,200); pFillSymbol.Outline=pCartoLineSyl; ICharacterMarkerSymbol pCharacterMarkerSymbol; pCharacterMarkerSymbol = new CharacterMarkerSymbolClass(); //设置它的字符,114为‘r’ pCharacterMarkerSymbol.CharacterIndex = 114; IMarkerFillSymbol pMarkerFillSymbol =new MarkerFillSymbolClass(); pMarkerFillSymbol.Outline=pCartoLineSyl; pMarkerFillSymbol.Style=esriMarkerFillStyle.esriMFSRandom; pMarkerFillSymbol.MarkerSymbol=pCharacterMarkerSymbol; pMarkerFillSymbol.GridAngle=45; pMarkerFillSymbol.Color=getRGB(0,255,255); IGeometry pGeo; pGeo = axMapControl2.TrackLine(); object oLineSymbol = pCartoLineSyl; axMapControl2.DrawShape(pGeo, ref oLineSymbol); } 画面 public void OnMouseDown(int Button, int Shift, int X, int Y) { IMxDocument mxDoc = m_App.Document as IMxDocument; IActiveView activeView = mxDoc.FocusMap as IActiveView; IScreenDisplay screenDisplay = activeView.ScreenDisplay; ISimpleFillSymbol fillSymbol = new SimpleFillSymbolClass(); IRgbColor rgbColor = new RgbColorClass(); rgbColor.Red = 255; fillSymbol.Color = rgbColor; IRubberBand rubberPolygon = new RubberPolygonClass(); IPolygon newPolygon = (IPolygon)rubberPolygon.TrackNew(screenDisplay, (ISymbol)fillSymbol); screenDisplay.StartDrawing(screenDisplay.hDC, (short)esriScreenCache.esriNoScreenCache); screenDisplay.SetSymbol((ISymbol)fillSymbol); screenDisplay.DrawPolygon(newPolygon); screenDisplay.FinishDrawing(); } 画矩形 public void OnMouseDown(int Button, int Shift, int X, int Y) { IMxDocument mxDoc = m_App.Document as IMxDocument; IActiveView activeView = mxDoc.FocusMap as IActiveView; IScreenDisplay screenDisplay = activeView.ScreenDisplay; ISimpleFillSymbol fillSymbol = new SimpleFillSymbolClass(); IRgbColor rgbColor = new RgbColorClass(); rgbColor.Red = 255; fillSymbol.Color = rgbColor; IRubberBand rubberEnv = new RubberEnvelopeClass(); IEnvelope newEnvelope = (IEnvelope)rubberEnv.TrackNew(screenDisplay, (ISymbol)fillSymbol); screenDisplay.StartDrawing(screenDisplay.hDC, (short)esriScreenCache.esriNoScreenCache); screenDisplay.SetSymbol((ISymbol)fillSymbol); screenDisplay.DrawRectangle(newEnvelope); screenDisplay.FinishDrawing(); }
  • 相关阅读:
    Dot Net WinForm 控件开发 (七) 为属性提下拉式属性编辑器
    WinForm 程序的界面多语言切换
    c#遍历HashTable
    Dot Net WinForm 控件开发 (三) 自定义类型的属性需要自定义类型转换器
    Dot Net WinForm 控件开发 (六) 为属性提供弹出式编辑对话框
    Dot Net WinForm 控件开发 (一) 写一个最简单的控件
    Dot Net WinForm 控件开发 (四) 设置属性的默认值
    Dot Net WinForm 控件开发 (二) 给控件来点描述信息
    Dot Net WinForm 控件开发 (八) 调试控件的设计时行为
    Dot Net WinForm 控件开发 (五) 复杂属性的子属性
  • 原文地址:https://www.cnblogs.com/adodo1/p/4327289.html
Copyright © 2011-2022 走看看