Zooming in/out with mouse wheel

Hi,

Currently, if I use the mouse wheel while holding down the CTRL key, my GoView zooms in/out (using the position of the mouse pointer as the point to zoom into).
Is there a way to alter this behaviour so that it isn't necessary for the CTRL key to be held down so that using the mouse wheel on its own zooms in/out. If so, how would this be done?
Thanks
Note this disables the normal scrolling behavior that mouse wheel provides.
[Serializable]
public class WheelZoomingTool : GoToolManager {
public WheelZoomingTool(GoView view) : base(view) { }
public override void DoMouseWheel() {
GoInputEventArgs evt = this.View.LastInput;
PointF oldpos = this.View.DocPosition;
this.View.DocScale *= (1 + ((float)evt.Delta)/2400);
PointF focus = this.View.ConvertViewToDoc(evt.ViewPoint);
this.View.DocPosition = new PointF(oldpos.X + evt.DocPoint.X - focus.X, oldpos.Y + evt.DocPoint.Y - focus.Y);
}
}

Install with:

goView1.Tool = goView1.DefaultTool = new WheelZoomingTool(goView1);

Thanks Jake, that works the way I wanted.

what is 2400 in mouse wheel code?

<span =“Apple-style-span” style="font-family: ‘Segoe UI’, Verdana, Arial; font-size: 13px; line-height: normal; ">The wheel has discrete, evenly spaced notches. When you rotate the wheel, a wheel message is sent as each notch is encountered. One wheel notch, a detent, is defined by the windows constant WHEEL_DELTA, which is 120. A positive value indicates that the wheel was rotated forward (away from the user); a negative value indicates that the wheel was rotated backward (toward the user).
<span =“Apple-style-span” style="font-family: ‘Segoe UI’, Verdana, Arial; font-size: 13px; line-height: normal; ">

<span =“Apple-style-span” style="font-family: ‘Segoe UI’, Verdana, Arial; font-size: 13px; line-height: normal; ">so… we are changing docscale by 1 + (120/2400) for each click of the wheel. in other words… 5%.

<span =“Apple-style-span” style=": rgb248, 248, 252; “> where to write this code i.e form load or the form constructor
<span =“Apple-style-span” style=”: rgb248, 248, 252; “>

<span =“Apple-style-span” style=”: rgb248, 248, 252; ">goView1.Tool = goView1.DefaultTool = new WheelZoomingTool(goView1);

<span =“Apple-style-span” style=": rgb248, 248, 252; “>

<span =“Apple-style-span” style=”: rgb248, 248, 252; ">If i put this feature,ctrl is hold and mouse wheel does not gives certain output.Actually my requirement is :zoom in ,zoom out buttons on top of the form and also two more buttons autofit,zoom100%.if on click on zoom in button,zoom in function ality is needed,or ctrl is held and mouse wheel rotate,zoom in functionality is required like…also zoom out or ctrl is held and mouse wheel rotate

Put that code somewhere in initialization after the GoView is created.