INewLineFeedback.Refresh() not working?

235
0
10-19-2010 01:08 PM
AlexanderDorofeev
New Contributor
Hi, I'm creating tool that draws line through certain points. For  visualization of the  line I use INewLineFeedBack, but it disappears when display is refreshed. Listening to IActiveView_Rereshed and calling INewLineFeedback.Refresh() on it  does not fix this. What should I do to use INewLineFeedBack in my tool without having troubles with display refresh?

Thanks in advance

this is a piece of my code

ESRI.ArcGIS.Display.INewLineFeedback _lineFeedBack = null;
...

public override void OnCreate(object hook)
        {
  
......
        
            ESRI.ArcGIS.Carto.IActiveViewEvents_Event activeEvent = (ESRI.ArcGIS.Carto.IActiveViewEvents_Event)GlobalValues.ActiveDocument.FocusMap;
            activeEvent.ViewRefreshed+=new IActiveViewEvents_ViewRefreshedEventHandler(activeEvent_ViewRefreshed);
        }

 void activeEvent_ViewRefreshed(IActiveView view, esriViewDrawPhase phase, object Data, IEnvelope envelope)
        {
            if (_lineFeedBack != null )
            {
                _lineFeedBack.Refresh(GlobalValues.ActiveDocument.ActiveView.ScreenDisplay.hDC);
            }
        }

 public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
.....
  if (_lineFeedBack == null)
                        {
                            _lineFeedBack = new ESRI.ArcGIS.Display.NewLineFeedbackClass();
                            _lineFeedBack.Display = GlobalValues.ActiveDocument.ActiveView.ScreenDisplay;
                            ESRI.ArcGIS.Display.IRgbColor rgbColor = new ESRI.ArcGIS.Display.RgbColorClass();
                            rgbColor.Red = 0; rgbColor.Green = 255; rgbColor.Blue = 0;
                            ESRI.ArcGIS.Display.ISimpleLineSymbol symbol=(ESRI.ArcGIS.Display.ISimpleLineSymbol)_lineFeedBack.Symbol;
                            symbol.Color = rgbColor;
                            _lineFeedBack.Start(featPoint);
                        }
                        else
                        {
                            _lineFeedBack.AddPoint(featPoint);
                        }
....
}

public override void OnMouseMove(int Button, int Shift, int X, int Y)
        {
IPoint point= GlobalValues.ActiveDocument.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);
                if (_lineFeedBack != null) _lineFeedBack.MoveTo(point);
....
}
0 Kudos
0 Replies