Profile Picture

How to add OnDragEnd event to a moveable Legend of a Chart

Posted By joern kunze 6 Years Ago

How to add OnDragEnd event to a moveable Legend of a Chart

Author
Message
joern kunze
Problem Posted 6 Years Ago
View Quick Profile
Junior Member

Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)

Group: Forum Members
Last Active: 4 Months Ago
Posts: 86, Visits: 221
Hi Experts,
I have a moveable Legend (using NOffserTool based Controller-Tool) where I want to save Legend-Coordinates after the Legend has been moved so that I can restore Legend position when needed.
Moving the Legend works good - but I have some trouble getting the Legend position after it has been moved. The NOffsetTool offers only OnDoDrag but no EndDrag event:
https://www.nevron.com/forum/uploads/images/d6aaed4b-bc4e-42cd-9908-f5a7.jpg
 Within the OnDoDrag I can get the coordinates continously while the Legend is moved - but I would like to get the coordinates only when the Legend Drag has been finished. Is there a way to achieve this ?

Furthermore I wonder if there is an easy way to get the Legend Coordinates in the LegendMoveTool
LocationChanged event.

Present Situation:
     LegendMoveTool hLegendMoveTool = new LegendMoveTool();
      hLegendMoveTool.LocationChanged += eventSink_OnLegendEndDrag;
      _NevronChart.Controller.Tools.Add(hLegendMoveTool);

where
  public void eventSink_OnLegendEndDrag(object sender, EventArgs e) {
    Console.WriteLine("OnLegendEndDrag");
           // How can I get the Legend coordinates here - EventArgs e seems not to have them ?
   }

and
public class LegendMoveTool : Nevron.Chart.Windows.NOffsetTool
{
...
  public override void OnDoDrag(object sender, NMouseEventArgs e) {
         // event is fired continously when Legend is moved ....
           NPoint oPoint = e.Location;
      Console.WriteLine("OnDoDrag: X=" + oPoint.X + " / Y=" + oPoint.Y);   // Coordinates of the Legends lower right corner
      base.OnDoDrag(sender, e);
   }
}

Thanks for your help,
Best regards,
Joern







Similar Topics


Reading This Topic