I was told to use "textBox1.Refresh()" instead of "textBox1.Invalidate();" and it works!
private void OnKeyDown(object sender, KeyEventArgs e)
{
//textBox1.Invalidate(); - Dont do that
textBox1.Refresh(); //Dominik Schelenz, my internet Hero for today!
using (Graphics g = this.textBox1.CreateGraphics())
{
int startX = 100;
int startY = 300;
int height = 200;
Brush brush = new SolidBrush(Color.FromArgb(60, 255, 0, 0));
Pen myPen = new Pen(Color.Black, 2);
myPen.DashStyle = DashStyle.Dash;
g.DrawRectangle(myPen, startX, startY, this.textBox1.Width, height);
g.FillRectangle(brush, startX, startY, this.textBox1.Width, height);
}
}