Not strong in this :L
Not good with Forms, Events and system.Drawing
Im making a key event draw a new Rectangle when the key is (Down) is pressed, but its not drawing a new rectangle when i press down continuously:
Can you please point me in the right direction, even though i've probably got this completely wrong :L
Shouldn't this be drawing a new rectangle, but displaced in Y Direction by 1 everytime the Down key is pressed?
EDIT:
Tried doing:
To move the current shape drawn, but it doesn't move at all.
Not good with Forms, Events and system.Drawing
Im making a key event draw a new Rectangle when the key is (Down) is pressed, but its not drawing a new rectangle when i press down continuously:
Code:
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
Graphics GE = Graphics.FromHwnd(this.Handle);
Pen PE = new Pen(Color.Black);
Rectangle NE = new Rectangle(15, 15, 20, 50);
if (e.KeyCode == Keys.Down)
{
NE.Y++;
GE.DrawRectangle(PE, NE);
}
}
Shouldn't this be drawing a new rectangle, but displaced in Y Direction by 1 everytime the Down key is pressed?
EDIT:
Tried doing:
Code:
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
Graphics GE = Graphics.FromHwnd(this.Handle);
Pen PE = new Pen(Color.Black);
Rectangle NE = new Rectangle(15, 15, 20, 50);
GE.DrawRectangle(PE, NE);
if (e.KeyCode == Keys.Down)
{
NE.OffSet(17,17);
}
}