Button Click with Key Pressed ?

J

JerryP

Hi Group,

is there any easy way to get the status of the CTRL Key in the Button Click
event ?
I'd like to implement a functionality compareable to Windows Explorer
DELTE - it behaves a little different if SHIFT is pressed,......

Thanks !

Jerry
 
J

Jeffrey Tan[MSFT]

Hi JeffryP

You can refer to the Control.ModifierKeys to determine the ctrl key's
status.
Something like this:
private void button1_Click(object sender, System.EventArgs e)
{
/* If the CTRL key is pressed when the control is clicked, hide the
control. */
if(Control.ModifierKeys == Keys.Control)
{
((Control)sender).Hide();
}
}

Hope this helps,

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "JerryP" <[email protected]>
| Subject: Button Click with Key Pressed ?
| Date: Fri, 17 Oct 2003 09:00:04 +0200
| Lines: 12
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: blueice1x.de.ibm.com 194.196.100.75
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:191999
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Hi Group,
|
| is there any easy way to get the status of the CTRL Key in the Button
Click
| event ?
| I'd like to implement a functionality compareable to Windows Explorer
| DELTE - it behaves a little different if SHIFT is pressed,......
|
| Thanks !
|
| Jerry
|
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top