画点
[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();
[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();
}
本文转自wenglabs博客园博客,原文链接:http://www.cnblogs.com/xiexiaokui/archive/2008/07/26/1251961.html,如需转载请自行联系原作者