Disable CTRL + MOUSE WHEEL

The zoom factor in TXTextControl.TextControl TX Text Control .NET for Windows Forms
TXTextControl Namespace
TextControl Class
The TextControl class implements a Windows Forms control with high-level text editing features.
can be set using CTRL + MOUSE WHEEL. Disabling this built-in functionality is possible using a simple trick. The MouseWheel event event itself cannot be canceled. Therefore you have to cast its arguments to HandledMouseEventArgs event. Then, you can handle the event, when key events are fired. Simply use an isKeyDown flag in the KeyUp and KeyDown event.

Loading...

Zoom Using Keyboard Only

Since zooming via the CTRL + MOUSEWHEEL has now been disabled, zooming using the keyboard only, can be added easily. In the KeyDown event, check if CTRL + Plus has been pressed. If yes, simply increase the current zoom factor by ten. If CTRL + Minus has been pressed, decrease the current value by ten. Since the zoom factor cannot be less than ten, Math.Max method is used to ensure that the value is never less than ten. Now, users can zoom in and out by pressing and holding CTRL and Plus or Minus.

Loading...

Set Zoom Level to Default

To reset the zoom back to the default value, press and hold CTRL + 0. This can be implemented in the KeyDown event with this code:

Loading...