Post: Using Hot Keys in C#
05-24-2012, 12:51 AM #1
DlBSY993
There's 0nly 1..
(adsbygoogle = window.adsbygoogle || []).push({}); Using Ctrl + Key to execute a command.

I know this is probably very old news for some users, But I have literally just got into C# programming and found these were very useful...
    
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == (Keys.Control | Keys.A))
{
txtMain.SelectAll();
return true;
}
if (keyData == (Keys.Control | Keys.C))
{
txtMain.Copy();
return true;
}
if (keyData == (Keys.Control | Keys.V))
{
txtMain.Paste();
return true;
}
if (keyData == (Keys.Control | Keys.U))
{
txtMain.Undo();
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}



This runs in the background and when one of the key combinations are pressed it runs the command associated with it.

(E.G txtMain.Undo()Winky Winky

It can also be changed to Shift, Alt Tab so on... Similar to screensnpr or Push.

Enjoy..
Last edited by DlBSY993 ; 05-24-2012 at 12:54 AM.

The following 3 users say thank you to DlBSY993 for this useful post:

Alexis Rhodes, Cien, Pichu
05-24-2012, 12:21 PM #2
TiCiiX
TiCiiX
Nice....................
07-12-2012, 06:04 AM #3
ive actually been wanting to know how to do something like this
07-16-2012, 07:26 AM #4
TacticalDuke
Do a barrel roll!
thanks bro helped me out

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo