Draw a rectangle code doesn't work please help me!!

Discussion in 'C#' started by ITStrawberry, Aug 28, 2010.

  1. ITStrawberry

    ITStrawberry New Member

    Joined:
    Aug 28, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi,

    I have this code. I need to draw a rectangle but i can't get it drawn onto the screen.
    Can anybode help me?

    Code:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    
    namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
                Graphics g = this.CreateGraphics();
                Pen pen = new Pen(Color.Black, 3);
                g.DrawRectangle(pen, 1, 1, 10, 10);
    
                
            }
    
            
            
        }
    }
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice