m working with arcobjects and i need to know that i have draw some polylines but the lines dont stay for long. i want the polylines to remain there until i click mouse button as we do in arcmap, a feature remain selected until we click any where else for unselect.
i have drawn polylines but the problem is that the lines dont stay for long, i want the polylines to stay on screen untill i click my mouse button. so please help me with something like dat
Have you tried storing them in a geodatabase after you draw them? It sounds like you're wanting to draw graphics on the screen, but you're wanting them to behave as a feature class. You could create an in-memory workspace or a geodatabase to a known location on disk within your code and reference.
i dont want to store the polylines to a permanent storage, actually the scene is like when i run my tool on two different layers it selects the points and draw polylines between points that have same ids... but the lines disapper immediately with in a second or two. so i want the lines to stay there temporarily and disappear after mouse click. as it happens in arcmap that the selection remains there until we click any where on screen.
so how could i do this please help me with it.
I'm still not sure if I completely understand what you're needing to accomplish. Could you upload a simplified version of your code that shows what you're doing within an addin? I'm hoping that you'd be able to display this within a single file using 100 or less lines of code. I'm guessing that you're drawing a graphic on the screen and it's getting cleared after the refresh is called.
this is what i am trying dear,
public void line()
IMxDocument mxdoc = ArcMap.Application.Document as IMxDocument;
IMap map = mxdoc.FocusMap;
IPointCollection pointColl = new Polyline();
foreach (var item in pointlist)
IPoint p3 = new ESRI.ArcGIS.Geometry.Point();
p3.X = item.XX;
p3.Y = item.YY;
IPolyline polyline = (IPolyline)pointColl;
polyline.SpatialReference = map.SpatialReference;
IActiveView activeView = mxdoc.ActiveView;
IScreenDisplay screenDisp = activeView.ScreenDisplay;
short screenCache = Convert.ToInt16(esriScreenCache.esriNoScreenCache);
IRgbColor color = new RgbColor();
color.Red = 255; color.Blue = 128; color.Green = 120;
ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbol();
simpleLineSymbol.Color = color;
simpleLineSymbol.Width = 2;
screenDisp.SetSymbol(simpleLineSymbol as ISymbol);
exactly the lines cleared immediately, but i am not using the refresh command n still its cleared.
i want lines to stay there until i click for refresh or any thing else. hope u understand my words now.
actually i dont want to store these lines in a permanent storage so do something for temporary storing.
I don't have ArcMap available to me ( I used to, but now I use the Runtime SDK), so I can't provide precise working code. Again, what you want to do is use the IActiveViewEvents.OnAfterDraw event (IActiveViewEvents implemented by the Map CoClass, I think). There should be plenty of samples and documentation on how to do this.
The tricky part though, I found, was the check for the 'draw phase'. Using this flag you can make your drawing code execute at different times, for example, right after map layers and before graphics ( by checking for for phase = geographyPhase or something like that).
Hope this helps.