Click here to Skip to main content
15,905,686 members
Home / Discussions / C#
   

C#

 
GeneralRe: Update designer after updating a property Pin
Christopher Stratmann6-Jul-07 4:28
Christopher Stratmann6-Jul-07 4:28 
AnswerRe: Update designer after updating a property Pin
Martin#6-Jul-07 6:57
Martin#6-Jul-07 6:57 
QuestionTool tip text in a button Pin
-spy-6-Jul-07 2:45
-spy-6-Jul-07 2:45 
AnswerRe: Tool tip text in a button Pin
kubben6-Jul-07 2:56
kubben6-Jul-07 2:56 
QuestionGDI: Move Rect. using KeyDown/Up and Timer Pin
oliiix6-Jul-07 2:31
oliiix6-Jul-07 2:31 
AnswerRe: GDI: Move Rect. using KeyDown/Up and Timer Pin
Luc Pattyn6-Jul-07 2:57
sitebuilderLuc Pattyn6-Jul-07 2:57 
GeneralRe: GDI: Move Rect. using KeyDown/Up and Timer Pin
oliiix6-Jul-07 3:56
oliiix6-Jul-07 3:56 
GeneralRe: GDI: Move Rect. using KeyDown/Up and Timer Pin
Luc Pattyn6-Jul-07 4:09
sitebuilderLuc Pattyn6-Jul-07 4:09 
Hi,

I dont really see the problem; when you press a key (say 'a') it generates one
KeyDown, one KeyUp and one KeyPressed. When you keep it down for a while it
autorepeats, i.e. it generates a number of KeyPressed events (same as in a
text editor such as MS Word; I am not sure it may also repeat the KeyDown,
but not the KeyUp). That could be sufficient.

If you want a faster repeat rate, I think you must provide it yourself; this
is how I would do it:
- create method doOneKey(Keys key) that does what that key should do
(including the Invalidate !)
- create a class member: private Keys lastKeyPressed
- in KeyDown do lastKeyPressed=e.KeyCode and call doOneKey(lastKeyPressed)
- create a Forms.Timer and let it tick continuously (say 100 msec)
- in timer tick handler call doOneKey(lastKeyPressed)
- in KeyUp do lastKeyPressed=Keys.None
- dont use KeyPress

You might want to also handle LostFocus event (so the move
stops when your Form loses focus)

BTW I have choosen the Forms.Timer because that one ticks on the GUI thread,
so it can not create concurrency problems (its tick does not get handled in
the middle of a key event).

Hope this helps

Smile | :)


AnswerRe: GDI: Move Rect. using KeyDown/Up and Timer Pin
oliiix6-Jul-07 4:20
oliiix6-Jul-07 4:20 
QuestionHow to set The Break point Condition in vs.NET Pin
Hum Dum6-Jul-07 2:20
Hum Dum6-Jul-07 2:20 
AnswerRe: How to set The Break point Condition in vs.NET Pin
kubben6-Jul-07 2:51
kubben6-Jul-07 2:51 
QuestionDialog event Pin
Maddie from Dartford6-Jul-07 1:59
Maddie from Dartford6-Jul-07 1:59 
AnswerRe: Dialog event Pin
Pete O'Hanlon6-Jul-07 2:02
mvePete O'Hanlon6-Jul-07 2:02 
AnswerRe: Dialog event Pin
Martin#6-Jul-07 2:04
Martin#6-Jul-07 2:04 
AnswerRe: Dialog event Pin
Chintan.Desai6-Jul-07 2:13
Chintan.Desai6-Jul-07 2:13 
QuestionNeed Suggestion for best Component Library for C# Pin
logikos6-Jul-07 1:43
logikos6-Jul-07 1:43 
AnswerRe: Need Suggestion for best Component Library for C# Pin
Pete O'Hanlon6-Jul-07 2:01
mvePete O'Hanlon6-Jul-07 2:01 
GeneralRe: Need Suggestion for best Component Library for C# Pin
logikos6-Jul-07 2:24
logikos6-Jul-07 2:24 
GeneralRe: Need Suggestion for best Component Library for C# Pin
Joseph Guadagno6-Jul-07 4:34
Joseph Guadagno6-Jul-07 4:34 
Questionmouse position + map lon/lat C# Pin
mercenary016-Jul-07 1:41
mercenary016-Jul-07 1:41 
AnswerRe: mouse position + map lon/lat C# Pin
Martin#6-Jul-07 1:47
Martin#6-Jul-07 1:47 
GeneralRe: mouse position + map lon/lat C# Pin
mercenary016-Jul-07 1:48
mercenary016-Jul-07 1:48 
AnswerRe: mouse position + map lon/lat C# Pin
Christian Graus6-Jul-07 1:57
protectorChristian Graus6-Jul-07 1:57 
GeneralRe: mouse position + map lon/lat C# Pin
mercenary016-Jul-07 2:00
mercenary016-Jul-07 2:00 
GeneralRe: mouse position + map lon/lat C# Pin
Christian Graus6-Jul-07 2:07
protectorChristian Graus6-Jul-07 2:07 

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.