ByteScout PDF Viewer SDK - C# - Custom MultiKey Press Event Handling - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

ByteScout PDF Viewer SDK – C# – Custom MultiKey Press Event Handling

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF Viewer SDK – C# – Custom MultiKey Press Event Handling

custom multikey press event handling in C# with ByteScout PDF Viewer SDK

Build custom multikey press event handling in C#

:

Step-by-step instructions on how to do custom multikey press event handling in C#

Writing of the code to custom multikey press event handling in C# can be done by developers of any level using ByteScout PDF Viewer SDK. ByteScout PDF Viewer SDK helps with custom multikey press event handling in C#. ByteScout PDF Viewer SDK is the component that helps in adding pdf viewer into your desktop WinForms application. User may select multiple areas with mouse, can use keyboard shortcuts and zoom in or zoom out and change scaling. You may read coordinates, handle custom painting code and retrieve text inside selection area.

If you want to quickly learn then these fast application programming interfaces of ByteScout PDF Viewer SDK for C# plus the guideline and the C# code below will help you quickly learn custom multikey press event handling. If you want to know how it works, then this C# sample code should be copied and pasted into your application’s code editor. Then just compile and run it. This basic programming language sample code for C# will do the whole work for you in implementing custom multikey press event handling in your app.

On our website you may get trial version of ByteScout PDF Viewer SDK for free. Source code samples are included to help you with your C# application.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Form1.Designer.cs
      
namespace MultikeyPressEventHandling { partial class Form1 { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.pdfViewerControl1 = new Bytescout.PDFViewer.PDFViewerControl(); this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this.tsbOpen = new System.Windows.Forms.ToolStripButton(); this.toolStrip1.SuspendLayout(); this.SuspendLayout(); // // pdfViewerControl1 // this.pdfViewerControl1.BackColor = System.Drawing.SystemColors.ButtonShadow; this.pdfViewerControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.pdfViewerControl1.Location = new System.Drawing.Point(0, 27); this.pdfViewerControl1.Margin = new System.Windows.Forms.Padding(4); this.pdfViewerControl1.MouseMode = Bytescout.PDFViewer.MouseMode.Hand; this.pdfViewerControl1.Name = "pdfViewerControl1"; this.pdfViewerControl1.RegistrationKey = null; this.pdfViewerControl1.RegistrationName = null; this.pdfViewerControl1.ResetRotationOnPageChange = false; this.pdfViewerControl1.Scale = 100; this.pdfViewerControl1.SelectionColor = System.Drawing.Color.Red; this.pdfViewerControl1.ShowImageObjects = true; this.pdfViewerControl1.ShowTextObjects = true; this.pdfViewerControl1.ShowVectorObjects = true; this.pdfViewerControl1.Size = new System.Drawing.Size(1123, 636); this.pdfViewerControl1.TabIndex = 0; this.pdfViewerControl1.PreProcessKey += new Bytescout.PDFViewer.PreProcessKeyEventHandler(this.PdfViewerControl1_PreProcessKey); // // toolStrip1 // this.toolStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.tsbOpen}); this.toolStrip1.Location = new System.Drawing.Point(0, 0); this.toolStrip1.Name = "toolStrip1"; this.toolStrip1.Size = new System.Drawing.Size(1123, 27); this.toolStrip1.TabIndex = 1; this.toolStrip1.Text = "toolStrip1"; // // tsbOpen // this.tsbOpen.Image = global::MultikeyPressEventHandling.Properties.Resources.folder_page; this.tsbOpen.ImageTransparentColor = System.Drawing.Color.Magenta; this.tsbOpen.Name = "tsbOpen"; this.tsbOpen.Size = new System.Drawing.Size(99, 24); this.tsbOpen.Text = "&Open PDF"; this.tsbOpen.Click += new System.EventHandler(this.tsbOpen_Click); // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1123, 663); this.Controls.Add(this.pdfViewerControl1); this.Controls.Add(this.toolStrip1); this.Margin = new System.Windows.Forms.Padding(4); this.Name = "Form1"; this.Text = "MultiKey Press Event - Try Shift+A, Ctrl-Alt-Shift-A"; this.toolStrip1.ResumeLayout(false); this.toolStrip1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private Bytescout.PDFViewer.PDFViewerControl pdfViewerControl1; private System.Windows.Forms.ToolStrip toolStrip1; private System.Windows.Forms.ToolStripButton tsbOpen; } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF Viewer SDK Home Page

Explore ByteScout PDF Viewer SDK Documentation

Explore Samples

Sign Up for ByteScout PDF Viewer SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

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; } } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF Viewer SDK Home Page

Explore ByteScout PDF Viewer SDK Documentation

Explore Samples

Sign Up for ByteScout PDF Viewer SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Program.cs
      
using System; using System.Collections.Generic; using System.Windows.Forms; namespace MultikeyPressEventHandling { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF Viewer SDK Home Page

Explore ByteScout PDF Viewer SDK Documentation

Explore Samples

Sign Up for ByteScout PDF Viewer SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF Viewer SDK Home Page

Explore ByteScout PDF Viewer SDK Documentation

Explore Samples

Sign Up for ByteScout PDF Viewer SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

prev
next