arc95
arc95

Reputation: 97

Detect more than 1 modifier keys (ctrl & alt) not combined

How to detect more than 1 moddifier keys? (Alt & Ctrl)?

I have this working code:

Private Sub PictureBox1_MouseWheel(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseWheel
    If ModifierKeys = Keys.Control Then
        If e.Delta <> 0 Then
            PictureBox1.Width += CInt(PictureBox1.Width * e.Delta / 1000)
            PictureBox1.Height += CInt(PictureBox1.Height * e.Delta / 1000)
        end if
     end if
end sub

if i change it into:
If ModifierKeys = (Keys.Control Or Keys.Alt) Then stop working. How can i detect both keys, but not combined?

Upvotes: 1

Views: 201

Answers (1)

jmcilhinney
jmcilhinney

Reputation: 54487

If ModifierKeys = Keys.Control OrElse ModifierKeys = Keys.Alt Then

That really should have been obvious.

Upvotes: 2

Related Questions