Artifacts From INewLineFeedback

Discussion created by chance.yohman on Aug 9, 2011
Latest reply on Aug 10, 2011 by chance.yohman
1) Compile in Visual Studio 2010 (I can throw it together in vs08, if someone is interested.)
2) Run.
3) Enable My Extension from the Extensions menu item.
4) From the Customize Menu accessed by right-clicking on the toolbar area, add the NewLineFeedback Tool from the NewLineFeedback category.
5) Click on the tool.
6) You'll notice a line that starts at (0,0) and follows the cursor around.

Previously if I zoomed to full extent, fixed zoom out, fixed zoom in, went to previous extent, went to next extent, or refreshed it left an artifact. I fixed that by using IActiveViewEvents in the extension with the AfterDraw event. See NewLineFeedbackExtension.cs for details. The issue I did not fix is if the user minimizes ArcMap, maximizes ArcMap, switches to a different app, or hovers on an item in the taskbar in Windows 7 to pop-up that particular item, then an artifact is left when ArcMap is refocused and the tool is moved around.

I've tried moving code all around, using IDisplayEvents, IDocumentEvents, and ITransformEvents. The artifact persists. I can get rid of it if I refresh (F5 or the tool). My guess is an old IScreenDisplay used by INewLineFeedback is left on the screen or the old INewLineFeedback object isn't released properly when I create a new one in AfterDraw. I've tried manually releasing the object too.

Any help would be appreciated. Thanks for your time.