Hi,I'm using the following code to draw a line on the screen (ie. not a feature). I'm using essentially the same methodolgy to successfully draw a point , but for some reason it won't work for a line. I don't get any error messages, I just don't see anything on the screen.I'm thinking it might be how I am setting the geometry of the line, but logically it seems like it should work.Any ideas??public static void DrawPolyline(ESRI.ArcGIS.Carto.IActiveView activeView, IPoint fromPoint, IPoint toPoint)
{
if (activeView == null)
{
return;
}
//Get the screen display
ESRI.ArcGIS.Display.IScreenDisplay screenDisplay = activeView.ScreenDisplay;
//Start drawing
screenDisplay.StartDrawing(screenDisplay.hDC,
(System.Int16)ESRI.ArcGIS.Display.esriScreenCache.esriNoScreenCache);
//Create the default line symbol
ESRI.ArcGIS.Display.ISimpleLineSymbol simpleLineSymbol = new
ESRI.ArcGIS.Display.SimpleLineSymbolClass();
ESRI.ArcGIS.Display.IRgbColor rgbColor = new ESRI.ArcGIS.Display.RgbColorClass();
rgbColor.Red = 255;
ESRI.ArcGIS.Display.IColor color = rgbColor;
simpleLineSymbol.Color = color;
simpleLineSymbol.Width = 4;
//Create the symbol that will be drawn as the default line symbol
ESRI.ArcGIS.Display.ISymbol symbol = (ESRI.ArcGIS.Display.ISymbol)simpleLineSymbol;
//Create a geometry using the to and from points
ILine line = new LineClass();
line.PutCoords(fromPoint, toPoint);
ESRI.ArcGIS.Geometry.IGeometry geometry = (ESRI.ArcGIS.Geometry.IGeometry)line;
//Finally, draw the line using the geometry
screenDisplay.SetSymbol(symbol);
screenDisplay.DrawPolyline(geometry);
screenDisplay.FinishDrawing();
}