Need to update drawing after a key is pressed
Posted on 2004-11-29
I have a simple program (Visual Basic.NET 2003) that draws a crosshair. I need to be able to move the crosshair up, down, left and right when the user pushes the standard arrow keys on the keyboard. I am drawing the crosshair in the Form1_Paint event using variables (x and y) with form-wide scope. I am updating x and y in the Form1_KeyDown event. Everything is working fine except that the drawing is not updating. It updates correctly when I drag another window over it.
All this is as expected. My question is, how do I refresh, updated or redraw my drawing at the end of my Form1_KeyDown event after I have incremented my x and y variables based on the user's input?