Grid Surface Mouse Wheel Behavior


Author
Message
Mark Malburg
Mark Malburg
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)
Group: Forum Members
Posts: 11, Visits: 68
Currently my Grid Surface chart is doing a "global zoom" quite nicely via:

NZoomTool zt = new NZoomTool();
zt.BeginDragMouseCommand = new NMouseCommand(MouseAction.Wheel, MouseButton.Middle, 0);
zt.ZoomStep = 16;
chartControl.Controller.Tools.Add(zt);


However, I'd like to catch Ctrl+Wheel as a way of affecting the chart's "Height" property.  How can I catch the Ctrl+Wheel to do this?   I can't seem to adjust height in a wheel handler without also getting the zoom from the NZoomTool.






Reply
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Mark,

You can create a custom tool based on the zoom tool that overrides the wheel action:

  class CustomZoomTool : NZoomTool
   {
    /// <summary>
    /// Processes wheel operations
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    public override void DoWheel(object sender, NMouseEventArgs e)
    {
      if ((ModifierKeys & Keys.Control) == Keys.Control)
      {
       if (this.GetActiveChart() != null)
       {
        this.GetActiveChart().Height *= (float)(1.0 + 10.0 / e.Delta);
        base.Repaint();
       }
      }
      else
      {
       base.DoWheel(sender, e);
      }
    }
   }

   private void Form1_Load(object sender, EventArgs e)
   {
    NChart chart = nChartControl1.Charts[0];
    chart.Enable3D = true;

    NBarSeries bar = new NBarSeries();

    bar.Values.Add(10);
    bar.Values.Add(20);
    bar.Values.Add(30);

    chart.Series.Add(bar);

    nChartControl1.Controller.Tools.Add(new NPanelSelectorTool());
    CustomZoomTool zt = new CustomZoomTool();
    zt.BeginDragMouseCommand = new NMouseCommand(MouseAction.Wheel, MouseButton.Middle, 0);
    zt.ZoomStep = 16;
    nChartControl1.Controller.Tools.Add(zt);
   }

Let us know if you meet any problems.

Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search