Zoom In/Out (Ctrl+MouseWheelUp OR Ctrl+MouseWheelDown)

Dec 30, 2015 at 7:39 PM
I want to send a Windows Zoom-In/Out commands to a RichTextBox (or any "zoomable" WinForms control). I know how to send commands using something like below but I cannot figure out how to Zoom (Ctrl+MouseWheelUp OR Ctrl+MouseWheelDown).

(I do not want Ctrl+"+")

Anyway, I tried these but they don't Zoom.
    private void button1_Click(object sender, EventArgs e)
    {
        var sim = new WindowsInput.InputSimulator();
        richTextBox1.Focus();
        sim.Keyboard.ModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.ZOOM);
        sim.Keyboard.ModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.SCROLL);
        sim.Keyboard.ModifiedKeyStroke(VirtualKeyCode.CONTROL)+sim.Mouse.VerticalScroll(100);
    }
Any ideas?
Oct 24, 2016 at 7:53 PM
From what I understand of the library, the ModifiedKeyStroke and KeyPress functions work as a "KeyDown" and then "KeyUp". What you need to do in order to use that shortcut is to hold the Ctrl key down while the vertical stroll happens -- so, switching ModifiedKeyStroke to KeyPress and then using the Mouse scroll function should (theoretically) work.

Hope this helps. I know this post is like 10 months old, though...
Oct 24, 2016 at 8:00 PM
Oh--word of caution: Be sure to use a "KeyUp" function after you're done, or the OS will be stuck thinking that key is held down. I fixed this once by rebooting my computer, but it's inconvenient and all you need is another line of code.