Draw a rectangle using Winforms

Posted by C. Karunarathne on Stack Overflow See other posts from Stack Overflow or by C. Karunarathne
Published on 2010-03-27T14:12:20Z Indexed on 2010/03/27 14:23 UTC
Read the original article Hit count: 459

Filed under:
|
|

Can I draw a rectangle with mouseClick?My code is not working so far.Can you help me?

    private void panel1_MouseClick(object sender, MouseEventArgs e)
    {
            Graphics g = this.CreateGraphics();
            Pen pen = new Pen(Color.Black, 2);

            g.DrawRectangle(pen, 100,100, 100, 200);
    }

© Stack Overflow or respective owner

Related posts about c#

Related posts about drawing