'This function handles keystrokes on keyboard Protected Overrides Function ProcessCmdKey(ByRef msg As Message, ByVal keyData As Keys) As Boolean 'Define function internal variables 'Dim statements here (if necessary) Select Case keyData 'detect up arrow key or home key Case Keys.Up, Keys.Home 'Here the code for action Return True 'detect down arrow key or end key Case Keys.Down, Keys.End 'Here the code for action Return True 'detect left arrow key Case Keys.Left 'Here the code for action Return True 'detect right arrow key Case Keys.Right 'Here the code for action Return True 'detect S key Case Keys.S 'Here the code for action Return True 'detect esc key Case Keys.Escape 'Here the code for action Return True End Select Return MyBase.ProcessCmdKey(msg, keyData) End Function '------------------------------------------------------------------------------------------- 'This subroutine handles mousewheel events Private Sub YourForm_MouseWheel(sender As Object, e As MouseEventArgs) Handles Me.MouseWheel 'Define subroutine internal variables 'Dim statements here (if necessary) If e.Delta > 0 Then 'Your action on scroll up Else 'Your action on scroll down End If End Sub '------------------------------------------------------------------------------------------- 'This subroutine handles image rotation by 90, 180 and 270 degree 'The presumption for this subroutine is: there is an PictureBox called "ImageBox" Private Sub RotateImage(Rotation As Single) 'Subroutine internal variable Dim TempImage As Bitmap Select Case Rotation Case 90 'Copy image from ImageBox to TempImage as a bitmap TempImage = CType(ImageBox.Image, Bitmap) 'Rotate the TempImage by 90 degree TempImage.RotateFlip(RotateFlipType.Rotate90FlipNone) 'Copy Tempimage to ImageBox ImageBox.Image = TempImage Case 180 'Copy image from ImageBox to TempImage as a bitmap TempImage = CType(ImageBox.Image, Bitmap) 'Rotate the TempImage by 180 degree TempImage.RotateFlip(RotateFlipType.Rotate180FlipNone) 'Copy Tempimage to ImageBox ImageBox.Image = TempImage Case 270 'Copy image from ImageBox to TempImage as a bitmap TempImage = CType(ImageBox.Image, Bitmap) 'Rotate the TempImage by 270 degree TempImage.RotateFlip(RotateFlipType.Rotate270FlipNone) 'Copy Tempimage to ImageBox ImageBox.Image = TempImage End Select End Sub