private
void axMapControl1_OnMouseDown(
object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e)
{
// 产生一个简单符号
ISimpleMarkerSymbol pMarkerSymbol = new SimpleMarkerSymbolClass();
pMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCross;
pMarkerSymbol.Color = GetRGBColor( 60, 100, 50);
pMarkerSymbol.Angle = 60;
pMarkerSymbol.XOffset = 10; // 符号偏移鼠标点击点横坐标的距离
pMarkerSymbol.YOffset = 10; // 符号偏移鼠标点击点纵坐标的距离
// 产生一个箭头符号
IArrowMarkerSymbol pArrowMarker = new ArrowMarkerSymbolClass();
pArrowMarker.Length = 5; // 箭头的顶点到底边的距离
pArrowMarker.Width = 10; // 箭头的底边的宽度
pArrowMarker.Color = GetRGBColor( 0, 60, 90);
pArrowMarker.XOffset = - 10;
pArrowMarker.YOffset = - 10;
// 产生一个叠加符号并把前面的符号加入
IMultiLayerMarkerSymbol pMulMarker = new MultiLayerMarkerSymbolClass();
pMulMarker.AddLayer(pArrowMarker);
pMulMarker.AddLayer(pMarkerSymbol);
IPoint pPoint = new PointClass();
pPoint.PutCoords(e.mapX, e.mapY);
object o = ( object)pMulMarker;
axMapControl1.DrawShape(pPoint, ref o);
}
private IRgbColor GetRGBColor( int red, int green, int blue)
{
IRgbColor pRgbColor = new RgbColorClass();
pRgbColor.Red = red;
pRgbColor.Green = green;
pRgbColor.Blue = blue;
return pRgbColor;
}
{
// 产生一个简单符号
ISimpleMarkerSymbol pMarkerSymbol = new SimpleMarkerSymbolClass();
pMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCross;
pMarkerSymbol.Color = GetRGBColor( 60, 100, 50);
pMarkerSymbol.Angle = 60;
pMarkerSymbol.XOffset = 10; // 符号偏移鼠标点击点横坐标的距离
pMarkerSymbol.YOffset = 10; // 符号偏移鼠标点击点纵坐标的距离
// 产生一个箭头符号
IArrowMarkerSymbol pArrowMarker = new ArrowMarkerSymbolClass();
pArrowMarker.Length = 5; // 箭头的顶点到底边的距离
pArrowMarker.Width = 10; // 箭头的底边的宽度
pArrowMarker.Color = GetRGBColor( 0, 60, 90);
pArrowMarker.XOffset = - 10;
pArrowMarker.YOffset = - 10;
// 产生一个叠加符号并把前面的符号加入
IMultiLayerMarkerSymbol pMulMarker = new MultiLayerMarkerSymbolClass();
pMulMarker.AddLayer(pArrowMarker);
pMulMarker.AddLayer(pMarkerSymbol);
IPoint pPoint = new PointClass();
pPoint.PutCoords(e.mapX, e.mapY);
object o = ( object)pMulMarker;
axMapControl1.DrawShape(pPoint, ref o);
}
private IRgbColor GetRGBColor( int red, int green, int blue)
{
IRgbColor pRgbColor = new RgbColorClass();
pRgbColor.Red = red;
pRgbColor.Green = green;
pRgbColor.Blue = blue;
return pRgbColor;
}
本文转自94cool博客园博客,原文链接:http://www.cnblogs.com/94cool/p/4363207.html,如需转载请自行联系原作者