Control zoom level of WinForms using mouse scroll wheel and Ctrl in VB.NET

AZhu picture AZhu · Mar 1, 2011 · Viewed 9.4k times · Source

If I have a winform, may I know how can I control the zoom level of the font in the application (as well as the application window itself obviously) by using Ctrl + Mouse Scroll Wheel? I see there is a Delta in the Scroll Wheel event, but not sure how that works. Is there any code sample that I can look into?

Answer

Tony O'Hagan picture Tony O'Hagan · Dec 1, 2011

I suspect that you can just test:

(VB.NET):

If (ModifierKeys And Keys.Control) = Keys.Control Then

(C#):

if( (ModifierKeys  & Keys.Control) == Keys.Control )

to check if the control key is down.