Location>code7788 >text

C# form custom shortcut key implementation - Open Source Research Series articles

Popularity:195 ℃/2024-08-12 09:29:55

This time, I thought about the use of shortcut keys for application forms.

The last time I posted an example of a shortcut (/lzhdim/p/18342051), the difference is that it is a hotkey registered globally by the operating system, and will be invalidated if other applications have registered corresponding hotkeys. This example is a shortcut to a key in a form, which is different from the global hotkey effect, and more in line with the application's effect.

 

1、 Project Catalog;

 

 

2、 Source Code Introduction;

1) Shortcut object;

 

 

2) Shortcut object definition;

 

 

3) Shortcut implementation;

 

 

4) Shortcut operation code;

 

 

3、 Run the interface;

 

 

4、 Introduction to use;

1) Refer to the code in the example for reuse.

2) Set a shortcut key in the configuration screen and click on that shortcut key on the form.

 

5、 Source download;

/download/lzhdim/89621777

 

6、 Other suggestions;

This example is a guideline, the rest of the reader is invited to reuse the code as needed.

 

The difference between this example and the last one is that the customized shortcuts are for a particular form, whereas the last one was a global hotkey registration for the operating system.