Click here to Skip to main content
15,887,485 members
Home / Discussions / C#
   

C#

 
GeneralRe: problem with unicode. Pin
David198711-May-11 21:38
David198711-May-11 21:38 
GeneralRe: problem with unicode. Pin
Keith Barrow11-May-11 23:31
professionalKeith Barrow11-May-11 23:31 
GeneralRe: problem with unicode. Pin
Richard MacCutchan11-May-11 22:23
mveRichard MacCutchan11-May-11 22:23 
AnswerRe: problem with unicode. Pin
Richard MacCutchan11-May-11 6:28
mveRichard MacCutchan11-May-11 6:28 
GeneralRe: problem with unicode. Pin
prasadbuddhika11-May-11 6:31
prasadbuddhika11-May-11 6:31 
AnswerRe: problem with unicode. [modified] Pin
Luc Pattyn11-May-11 7:17
sitebuilderLuc Pattyn11-May-11 7:17 
AnswerRe: problem with unicode. Pin
jschell11-May-11 8:31
jschell11-May-11 8:31 
QuestionForms.Panel - stop OnKeyDown repeating [modified] Pin
lukeer11-May-11 4:31
lukeer11-May-11 4:31 
Hi experts,

I'm creating a custom control DerivedPanel. It's derived from System.Windows.Forms.Panel. There are no other controls on DerivedPanel. Instead it draws custom items called Devices.

I'd like to resemble the selection behaviour of Windows XP's desktop. That includes holding the CTRL button down while dragging a selection rectangle. That should cause each Device within the rectangle to toggle its selection state.

For the CTRL key, I used
protected override void OnKeyDown(KeyEventArgs e)
{
    Console.WriteLine("OnKeyDown: " + e.KeyValue.ToString());

    base.OnKeyDown(e);

    if (e.Control)
    {
        Console.WriteLine("Setting XOR devices...");
        _selectionXoringDevices.AddRange(_project.Devices.SelectedDevices);
    }
    else
        Console.WriteLine("Lazying...");
}
Now the problem is that as long as I'm holding down the CTRL key, this event keeps firing over and over again.

I need it to fire once on keypress.

Funny enough, the corresponding OnKeyUp() works just that way.

How can I get a method to execute once on pressing down the CTRL key?


Edit: I need this to work in .NET 2.0.

Ciao,


luker
modified on Thursday, May 12, 2011 2:06 AM

AnswerRe: Forms.Panel - stop OnKeyDown repeating Pin
Luc Pattyn11-May-11 4:38
sitebuilderLuc Pattyn11-May-11 4:38 
GeneralRe: Forms.Panel - stop OnKeyDown repeating Pin
lukeer11-May-11 20:16
lukeer11-May-11 20:16 
AnswerRe: Forms.Panel - stop OnKeyDown repeating Pin
Luc Pattyn12-May-11 0:42
sitebuilderLuc Pattyn12-May-11 0:42 
AnswerRe: Forms.Panel - stop OnKeyDown repeating Pin
lukeer11-May-11 21:08
lukeer11-May-11 21:08 
GeneralRe: Forms.Panel - stop OnKeyDown repeating Pin
BobJanova12-May-11 1:43
BobJanova12-May-11 1:43 
QuestionRegex to retrieve phone numbers Pin
Etienne_12311-May-11 0:39
Etienne_12311-May-11 0:39 
AnswerRe: Regex to retrieve phone numbers Pin
Hiren solanki11-May-11 1:32
Hiren solanki11-May-11 1:32 
GeneralRe: Regex to retrieve phone numbers Pin
Etienne_12311-May-11 1:42
Etienne_12311-May-11 1:42 
GeneralRe: Regex to retrieve phone numbers Pin
Hiren solanki11-May-11 1:44
Hiren solanki11-May-11 1:44 
GeneralRe: Regex to retrieve phone numbers Pin
Etienne_12311-May-11 1:51
Etienne_12311-May-11 1:51 
GeneralRe: Regex to retrieve phone numbers Pin
Hiren solanki11-May-11 1:53
Hiren solanki11-May-11 1:53 
AnswerRe: Regex to retrieve phone numbers Pin
PIEBALDconsult11-May-11 2:40
mvePIEBALDconsult11-May-11 2:40 
QuestionCan't apply Contrast of Image Pin
Anubhava Dimri11-May-11 0:04
Anubhava Dimri11-May-11 0:04 
AnswerRe: Can't apply Contrast of Image Pin
Luc Pattyn11-May-11 0:21
sitebuilderLuc Pattyn11-May-11 0:21 
GeneralRe: Can't apply Contrast of Image Pin
Anubhava Dimri11-May-11 0:35
Anubhava Dimri11-May-11 0:35 
GeneralRe: Can't apply Contrast of Image Pin
Luc Pattyn11-May-11 0:46
sitebuilderLuc Pattyn11-May-11 0:46 
GeneralRe: Can't apply Contrast of Image [modified] Pin
Anubhava Dimri11-May-11 1:00
Anubhava Dimri11-May-11 1:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.