Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jun 19, 2012 08:04 PM by acheo
Jun 19, 2012 08:04 PM|LINK
I am calling the following code from my main program. I checked with the debugger and the code gets executed. However, there is no rectangle drawn on the screen. Any idea why?
Graphics surface = this.CreateGraphics();
Pen pen1 = new Pen(System.Drawing.Color.Red, 1.0f);
Rectangle rec1 = new Rectangle(10, 10, 100, 100);
PaintEventArgs arg = new PaintEventArgs(surface, rec1);
private void DrawRectangleRectangle(PaintEventArgs e)
// Create pen.
Pen blackPen = new Pen(Color.Black, 3);
// Create rectangle.
Rectangle rect = new Rectangle(0, 0, 200, 200);
// Draw rectangle to screen.