Overriding mouse control with Zedgraph?

I am using ZedGraph and I want to increase the selection by holding Ctrl and dragging the field with the left mouse button, rather than clicking and dragging the middle mouse button.

By default, scaling is used with the left mouse button and for panning with the middle mouse button, but I have already enabled these two operations.

Does anyone know how to do panning by clicking and dragging the left button (without holding Ctrl), and zooming is done by holding Ctrl and then clicking and dragging with the left button?

+4
source share
2 answers

ZedGraphControl allows you to control pan and zoom through the properties of the control. To enable panning only with the left mouse button:

 zg1.PanButtons = MouseButtons.Left; zg1.PanModifierKeys = Keys.None; 

and enable Zoom with Ctrl + Left mouse button:

 zg1.ZoomButtons = MouseButtons.Left; zg1.ZoomModifierKeys = Keys.Control; 

The constructor properties window does not seem to allow you to simply specify Control for modifier keys, so you have to put it in the code - the Form Load event handler, for example.

+9
source

Do you try using the code:

zg.GraphPane.XAxis.Scale.Min = xxxx;
zg.GraphPane.XAxis.Scale.Max = yyyy;

//and

zgc.ScrollGrace = 0.1;

0
source

All Articles