Recently I created one control library in C#.Net for Windows application. In this section we going to see how to use it.
Smart Hot key handler allows to windows application to subscribe all registered hot key events with minimum efforts. It supports to register all normal keys and function keys as hot key with or without key modifiers (Alt, Shift, Control and Windows).But Windows key modifier combination hot-keys not working properly in this version, if you have any workaround or solution please share with me along with your feedback.
You can get full source code of this handler at Smart Hotkey from http://smarthotkey.codeplex.com/.
Follow the following steps to test the smart hot key handler with test application.
1) Create a new Windows Application from Visual Studio 2008.
2) Add Smart Hotkey control to Toolbox (if not available) then drag and drop on to your form.
3) Open your form code file and add following line of code at constructor of the form.
Code:
this.hotKey1.HotKeyPressed += new SmartHotKey.HotKey.HotKeyEventHandler(hotKey1_HotKeyPressed);
4) Add the hotkey press event handler.
Code:
void hotKey1_HotKeyPressed(object sender, SmartHotKey.HotKeyEventArgs e)
{
MessageBox.Show(e.HotKey);
}
5) Register your required hotkeys.
Code:
//normal keys
this.hotKey1.AddHotKey("S");
this.hotKey1.AddHotKey("A");
//normal keys with keymodifiers
this.hotKey1.AddHotKey("Control+Shift+Alt+U");
this.hotKey1.AddHotKey("Control+Shift+E");
//function keys
this.hotKey1.AddHotKey("F2");
this.hotKey1.AddHotKey("F9");
//function keys with keymodifiers
this.hotKey1.AddHotKey("Shift+F1");
//other keys[Home,End,PageDown,PageUp and Delete]
this.hotKey1.AddHotKey("Shift+End");
this.hotKey1.AddHotKey("End");
6) Add following line of code inside of the Dispose method.
Code:
//remove all keys
this.hotKey1.RemoveAllKeys();
//remove specific key
this.hotKey1.RemoveKey("Shift+End"); //you can call this method where ever you want to remove a hotkey.
7) Now run and test your application and you will following output messages.
Same way you can handle hot key events in your real world applications without writing much codes.
If you feel free please send your feedback to eshock.vasan@gmail.com.
Labels
Popular Posts
About
About
Follow us
Popular Posts
-
In this article I am going to explain how to dynamically display all available process templates (Skelta forms which associated with a workf...
-
The main feature of any workflow engine is tracking the histories of transactions for its process flows, normally all workflow engines will ...
-
Skelta provides the feature to initiate a workflow from a Skelta form by associating it. In Skelta Enterprise Console they given the provisi...
-
Recently I created one control library in C#.Net for Windows application. In this section we going to see how to use it. Smart Hot key handl...
-
Visual Studio providing a feature called Custom Template to create our own project templates(Web,Windows etc,.) and Item templates(Web Form,...
-
In Skelta BPM.Net 2009 they introduced dynamic form, we can design our required dynamic forms and attach with workflow in form of Invoke For...