Profile Picture

Grid Surface Mouse Wheel Behavior

Posted By Mark Malburg 8 Years Ago
Author
Message
Mark Malburg
Posted 8 Years Ago
View Quick Profile
Forum Newbie

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
Last Active: 5 days ago @ 4:07 AM
Posts: 11, Visits: 64
Thanks!

Nevron Support
Posted 8 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: Yesterday @ 1:54 AM
Posts: 3,054, Visits: 4,009
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



Mark Malburg
Posted 8 Years Ago
View Quick Profile
Forum Newbie

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
Last Active: 5 days ago @ 4:07 AM
Posts: 11, Visits: 64
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.









Similar Topics


Reading This Topic