Click here to Skip to main content
15,906,816 members
Home / Discussions / C#
   

C#

 
GeneralRe: problem with unicode. Pin
prasadbuddhika11-May-11 6:28
prasadbuddhika11-May-11 6:28 
GeneralRe: problem with unicode. Pin
David198711-May-11 6:46
David198711-May-11 6:46 
GeneralRe: problem with unicode. Pin
Peter_in_278011-May-11 14:47
professionalPeter_in_278011-May-11 14:47 
GeneralRe: problem with unicode. Pin
David198711-May-11 19:58
David198711-May-11 19:58 
GeneralRe: problem with unicode. Pin
Peter_in_278011-May-11 20:40
professionalPeter_in_278011-May-11 20:40 
GeneralRe: problem with unicode. Pin
David198711-May-11 20:46
David198711-May-11 20:46 
GeneralRe: problem with unicode. Pin
Peter_in_278011-May-11 20:58
professionalPeter_in_278011-May-11 20:58 
GeneralRe: problem with unicode. Pin
David198711-May-11 21:05
David198711-May-11 21:05 
GeneralRe: problem with unicode. Pin
Peter_in_278011-May-11 21:21
professionalPeter_in_278011-May-11 21:21 
GeneralRe: problem with unicode. [modified] Pin
David198711-May-11 21:29
David198711-May-11 21:29 
GeneralRe: problem with unicode. Pin
Richard MacCutchan11-May-11 22:12
mveRichard MacCutchan11-May-11 22:12 
GeneralRe: problem with unicode. Pin
Luc Pattyn12-May-11 1:09
sitebuilderLuc Pattyn12-May-11 1:09 
GeneralRe: problem with unicode. Pin
David198711-May-11 21:29
David198711-May-11 21:29 
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 

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.