473,396 Members | 1,767 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how can i catch keyboard shortcuts

i want to add shorcuts like ALT+M or CTRL+k
to my windows application.
is it posible to define shortcuts and catch them?
Thanks
Richard
Nov 16 '05 #1
1 3004
On 9 Oct 2004 15:05:56 -0700, richard <ds****@hotmail.com> wrote:
i want to add shorcuts like ALT+M or CTRL+k
to my windows application.
is it posible to define shortcuts and catch them?
Thanks
Richard


Try this:
http://msdn.microsoft.com/library/de...ydowntopic.asp
The KeyEventArgs event also contains the properties Alt, Shift and Control
which you can check for trure/false.

Here's an example from
http://msdn.microsoft.com/library/de...classtopic.asp

private void textBox1_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e)
{
// Determine whether the key entered is the F1 key. If it is, display
Help.
if(e.KeyCode == Keys.F1 && (e.Alt || e.Control || e.Shift))
{
// Display a pop-up Help topic to assist the user.
Help.ShowPopup(textBox1, "Enter your name.", new
Point(textBox1.Bottom, textBox1.Right));
}
else if(e.KeyCode == Keys.F2 && e.Modifiers == Keys.Alt)
{
// Display a pop-up Help topic to provide additional assistance to
the user.
Help.ShowPopup(textBox1, "Enter your first name followed by your
last name. Middle name is optional.",
new Point(textBox1.Top, this.textBox1.Left));
}
}

--
Jonas
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Spartanicus | last post by:
Some use the kbd element (Example: <kbd>Ctrl</kbd>+<kbd>G</kbd>) to mark up keyboard shortcuts, but the spec defines kbd as: "Indicates *text* to be entered by the user." (emphasis mine). UA...
0
by: ekta | last post by:
How do we write the code for Keyboard shortcuts in asp.net(c#).Is it possible through javascript only or there is any method/property availaible (like Accesskey) in asp.net. Thanks
5
by: bob lambert | last post by:
Hi, I have a vb .net std 2002 windows form app and wanted to use keyboard shortcuts (& in text property input) It shows up on the design view, but when I build (in debug mode) and display the...
4
by: Helene Day | last post by:
Sorry, this could be a newby question... but how do we do the keyboard shortcuts in .NET buttonname.text = "&Click Me" Does not give the short cut Alt-C for the button. Helene
0
by: Mishaev Mark | last post by:
Hi all, How can I disable the standard keyboard shortcuts that are automatically processed by Visio (Ctrl-D for example)? I've tried to use KeyUp event to set "CancelDefault" property to...
1
by: Erland | last post by:
Hello, I am using asp.net 2.0 and I want to add keyboard shortcuts to my application just like the shortcuts you see in GMAIL. I was wondering how can I do this in ASP.NET? Scenerio that would...
0
by: Zytan | last post by:
I cannot use & to implement a keyboard shortcut on a TabPage like I can on a Button. Is there a way to easily do this? Maybe TabPages aren't supposed to have keyboard shortcuts, but it would be...
331
by: Xah Lee | last post by:
http://xahlee.org/emacs/modernization.html ] The Modernization of Emacs ---------------------------------------- THE PROBLEM Emacs is a great editor. It is perhaps the most powerful and...
1
by: Gilbert Tordeur | last post by:
Hello, Context = Web site with VB2008. Is it possible to define keyboard shortcuts on a webpage, to make it possible for the user to "click" on a button or a link, or to set the focus on a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.