Custom MultiKey Press Event Handling | VB.NETByteScout PDF Viewer SDK

Custom MultiKey Press Event Handling | VB.NET

Form1.vb:

VB
Imports System.Windows.Forms

Public Partial Class Form1
    Inherits Form

    Public Sub New()
        InitializeComponent()
    End Sub

    Private Sub tsbOpen_Click(ByVal sender As Object, ByVal e As EventArgs) Handles tsbOpen.Click

        Using openFileDialog As New OpenFileDialog()

            openFileDialog.Title = "Open PDF Document"
            openFileDialog.Filter = "PDF Files (*.pdf)|*.pdf|All Files|*.*"

            If openFileDialog.ShowDialog() = DialogResult.OK Then

                Me.Text = openFileDialog.FileName

                Cursor = Cursors.WaitCursor

                Try
                    pdfViewerControl1.InputFile = openFileDialog.FileName
                Catch exception As Exception
                    MessageBox.Show(exception.Message)
                Finally
                    Cursor = Cursors.[Default]
                End Try

            End If

        End Using

    End Sub

    Private Sub PdfViewerControl1_PreProcessKey(source As Object, keyData As Keys, ByRef handled As Boolean) Handles pdfViewerControl1.PreProcessKey

        If keyData = (Keys.A Or Keys.Shift) Then
            MessageBox.Show("Shift-A")
            handled = True
        End If

        If keyData = (Keys.A Or Keys.Control Or Keys.Alt Or Keys.Shift) Then
            MessageBox.Show("Ctrl-Alt-Shift-A")
            handled = True
        End If

    End Sub

End Class

Program.vb:

VB
Imports System.Collections.Generic
Imports System.Windows.Forms

NotInheritable Class Program
    Private Sub New()
    End Sub
    ''' <summary>
    ''' The main entry point for the application.
    ''' </summary>
    <STAThread> _
    Friend Shared Sub Main()
        Application.EnableVisualStyles()
        Application.SetCompatibleTextRenderingDefault(False)
        Application.Run(New Form1())
    End Sub
End Class