//可选参数的设置
object Missing = Type.Missing;
//定义一个多义线对象
IPolyline line1 = new PolylineClass();
IPointCollection ptclo1 = line1 as IPointCollection;
ptclo1.AddPoint(p2, ref Missing, ref Missing);
ptclo1.AddPoint(p, ref Missing, ref Missing);
IRgbColor pRgbColor;
ISimpleLineSymbol pSimpleLineSymbol;
pActiveView = ArcMap.Document.ActiveView;
pSimpleLineSymbol = new SimpleLineSymbolClass();
pSimpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
pRgbColor = new RgbColorClass();
pRgbColor.Red = 125;
pSimpleLineSymbol.Color = pRgbColor;
ILineElement pLineElement1;
pLineElement1 = new LineElementClass();
pLineElement1.Symbol = pSimpleLineSymbol;
IElement pElement1 = new LineElement();
pElement1 = pLineElement1 as IElement;
pElement1.Geometry = line1 as IGeometry;
IGraphicsContainer pGraphicsContainer = ArcMap.Document.ActiveView.FocusMap as IGraphicsContainer;
pGraphicsContainer.AddElement(pElement1, 0);
ArcMap.Document.ActiveView.Refresh();