Custom MultiKey Press Event Handling - C#
PDF Viewer SDK sample in C# demonstrating ‘Custom MultiKey Press Event Handling’
Form1.cs
using System;
using System.Windows.Forms;
namespace MultikeyPressEventHandling
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void tsbOpen_Click(object sender, EventArgs e)
{
using (OpenFileDialog openFileDialog = new OpenFileDialog())
{
openFileDialog.Title = @"Open PDF Document";
openFileDialog.Filter = @"PDF Files (*.pdf)|*.pdf|All Files|*.*";
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
this.Text = openFileDialog.FileName;
Cursor = Cursors.WaitCursor;
try
{
pdfViewerControl1.InputFile = openFileDialog.FileName;
}
catch (Exception exception)
{
MessageBox.Show(exception.Message);
}
finally
{
Cursor = Cursors.Default;
}
}
}
}
private void PdfViewerControl1_PreProcessKey(object source, Keys keyData, ref bool handled)
{
if (keyData == (Keys.A | Keys.Shift))
{
MessageBox.Show("Shift-A");
handled = true;
}
if (keyData == (Keys.A | Keys.Control | Keys.Alt | Keys.Shift))
{
MessageBox.Show("Ctrl-Alt-Shift-A");
handled = true;
}
}
}
}
Form1.Designer.cs
��n a m e s p a c e M u l t i k e y P r e s s E v e n t H a n d l i n g
{
p a r t i a l c l a s s F o r m 1
{
/ / / <