Profile Picture

Reset Offset after using NOffsetTool

Posted By Alexander Haberl 11 Years Ago
Author
Message
Alexander Haberl
Posted 11 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 15, Visits: 48
Hi!

I'm allowing the user to move the chart around with the help of a NOffsetTool:

NOffsetTool ot = new NOffsetTool();
ot.BeginDragMouseCommand = new NMouseCommand(MouseAction.Down, System.Windows.Forms.MouseButtons.Right, 1);
ot.EndDragMouseCommand = new NMouseCommand(MouseAction.Up, System.Windows.Forms.MouseButtons.Right, 1);
chartControl.Controller.Tools.Add(ot);

Now I want to reset the offset by clicking on a button. Can this be done? I already tried:

chartControl.Charts[0].Offset(chartControl.View.Context, new NPointL(x, y));

but of course I dont no the values for x and y.

Please help!

Thanks a lot!


Nevron Support
Posted 11 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: 1 days ago @ 1:54 AM
Posts: 3,054, Visits: 4,009

Hi Alexander,

You need to modify the panel location - the following code shows how to revert to the location before you started to drag the panel:

   NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];
   nChartControl1.Controller.Selection.SelectedObjects.Add(chart);


   NOffsetTool tool = new NOffsetTool();
   tool.BeginDrag += new EventHandler(tool_BeginDrag);
   nChartControl1.Controller.Tools.Add(tool);

....

  Stack<NPointL> m_LocationStack = new Stack<NPointL>();
  void tool_BeginDrag(object sender, EventArgs e)
  {
   m_LocationStack.Push(nChartControl1.Charts[0].Location);
  }
  private void button1_Click(object sender, EventArgs e)
  {
   if (m_LocationStack.Count > 0)
   {
    nChartControl1.Charts[0].Location = m_LocationStack.Pop();
    nChartControl1.Refresh();
   }
  }



Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic