I have a
BaseTool for AX_MapControl and AX_PageLayoutControl that allows to draw a polyline via
IRubberBand. But once the rubberband is started, you can't cancel it e.g. by hitting escape. I found
ITrackCancel but unfortunatly no way to use it properly.
ITrackCancel2 esc = new CancelTrackerClass(); esc.CancelOnKeyPress = true; esc.Reset(); IRubberBand2 rubberBand = new RubberLineClass(); IGeometry geometry = rubberBand.TrackNew(screenDisplay, null); IPolyline polyline = (IPolyline)geometry;
How do I use ITrackCancel to cancel the rubberband tracking?
ITrackCancel can be retrieved from
IScreenDisplay but my
m_hookHelper.ActiveView.ScreenDisplay.CancelTracker is null. I use the tool with
I found out, that even Esris own tools like
esriControls.ControlsNewLineTool can't be canceled with escape in my application. Maybe there is a deeper flaw somewhere. Going to dive deeper into it...
Update 3 (Solution):
There is a glitch in my WPF application. It seems, that on startup no key events arrive the MapControl until you change the window size once. So this is not a problem with
ITrackCancel but with the interaction between WPF and ArcEngine.
Thanks anyways for your help.