Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
463
Dragging Annotations
posted

 

Hello........

I am using different types of Annotations on ultra chart. Now I want to drag these Annotations at different

locations as enduser needs.

Whenever I try to drag any of the annotations, only one specific annotation (which was added first ) is 

dragging. How can I identify that  which Annotation has been selected by the user ?

i am using this code :

 public override bool CanStart()
        {
            foreach (Annotation annotation in this.UltraChart.Annotations.Annotations)
            {

 //Box Annotation  
               BoxAnnotation boxAnnotation = annotation as BoxAnnotation;
               if (boxAnnotation == null)
                   continue;

               Point pt = new Point((int)boxAnnotation.Location.LocationX, (int)boxAnnotation.Location.LocationY);
                Size size = boxAnnotation.GetBoxSize();

              pt.X -= size.Width / 2;
               pt.Y -= size.Height / 2;

                Rectangle rect = new Rectangle(pt, size);

              if (rect.Contains(this.LastInput.ViewPoint) == false)
                   return false;

               this.draggingAnnotation = boxAnnotation;

               this.prevPoint = this.LastInput.ViewPoint;

 

           // EllipseAnnotation

                EllipseAnnotation _ellipseAnnotation = annotation as EllipseAnnotation;
                if (_ellipseAnnotation == null)
                    continue;

                Ellipse _ellipse = new Ellipse(new Point((int)_ellipseAnnotation.Location.LocationX), new Point((int)_ellipseAnnotation.Location.LocationY));

                // Rectangle rect = new Rectangle(pt, size);

                //if (rect.Contains(this.LastInput.ViewPoint) == false)
                // return false;

                this.draggingAnnotation = _ellipseAnnotation;

                this.prevPoint = this.LastInput.ViewPoint;

        }

}

 

 Thanks

Dilip Natani