I\'m working on programming a Tetris game in Visual C# 2005. This is the most extensive program I have designed yet.
I create a shape class and a block class to cont
If you're relying on key repeat to repeatedly send key down events to make the block move, I don't think this is the way you want to do it. The block should move consistently independent of key repeat. Therefore you should not be moving the block during the key events. You should only be tracking the state of the keys during the keydown and keyup events, and handle movement elsewhere. The actual movement should take place either in some sort of timer event (a timer control fires events at regular intervals even if nothing is going on) or you should have a main loop constantly checking the state of everything and moving objects when appropriate. If you use the second option, you will need to look into "DoEvents" because if you have code that's constantly running without ever finishing the function, the program will not process any other events such as keyup and keydown events. So you would want to call DoEvents within each loop to process the key events (among other things like moving the window). You might also want to call System.Threading.Thread.Sleep if you don't need to be processing things quite so constantly. If you use a timer control, you shouldn't have to worry about any of that.