Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm writing a C# add-in and trying to implement a piece where a user can add points to a graphics layer on the map view. The points are drawing, however the map pane has serious ghosting issues and I lose the ability to scroll zoom in and out. I assume the problem is in the way I am refreshing the display. Any input would be great. Thanks,

protected override void OnMouseDown(MouseEventArgs arg)
    {

        base.OnMouseDown(arg);
        IGeometry pointcreate = drawPoint(ArcMap.Document.ActiveView, arg.X, arg.Y); //This creates the point but does not actually place it on screen
        IRgbColor newColor = new RgbColorClass();
        newColor.Red = 128;
        IMap thisMap = getMap(ArcMap.Application);
        addGraphicToMap(thisMap, pointcreate, newColor,newColor); //this actually places the graphic on screen.
        IPoint newPoint = ScrCoordToMapCoord(arg.X, arg.Y, ArcMap.Document.ActiveView);
        ArcMap.Document.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); //This is the refresh in question, I think.

}

share|improve this question
    
Are you calling IScreenDisplay.StartDrawing anywhere? –  Kirk Kuykendall Jun 15 '12 at 18:15
    
It's being called inside of the drawPoint method. Upon my review of this, I noticed I had not called the IScreenDisplay.FinishDrawing(). I stuck that in and everything is working fine now. Thanks for the nudge in the right direction. –  AHigh Jun 15 '12 at 18:22
add comment

1 Answer

up vote 2 down vote accepted

Anytime you call IScreenDisplay.StartDrawing, be sure you call IScreenDisplay.FinishDrawing, otherwise your display caches can become corrupted. To be safe, consider calling FinishDrawing in an exception handler.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.