C# ArcEngine,如何根据已有的两点的XY坐标,把这条线在地图上显示出来?

2025-04-03 14:46:00
推荐回答(2个)
回答1:

IPoint p1 = new PointClass();
IPoint p2 = new PointClass();
p1.X = 75;
p1.Y = 5;
p2.X = 75;
p2.Y = 65;
ILine DisplayLine = new LineClass();
DisplayLine.PutCoords(p1, p2);

回答2:

IPoint pt;
pt = new Point();
pt.x=_x;pt.y =_y;
IMarkerElement pMarkerElement;
pMarkerElement = new MarkerElementClass();
IElement pElement;
pElement = pMarkerElement as IElement;
pElement.Geometry = pt;
pGraphicsContainer = pMap as IGraphicsContainer;
pGraphicsContainer.AddElement((IElement)pMarkerElement, 0);
pActiveView.Refresh();