title: Painting a rectangle
body: <p>I'm very new to windows form coding and I'm trying to make a minipaint which has three buttons (circle,rectangle and line) and when it gets a button as an input , it will draw the shape in panel.
  I have this shape class</p>
  
  <pre><code>class shape
  { 
     public Color color { get; set; }
     public int width { get; set; }
     public int startx { get; set; }
     public  int starty { get; set; }
  }
  </code></pre>
  
  <p>which has color,width and start position properties.then I have this rectangle class for example:</p>
  
  <pre><code>class rectangle : shape
  {
      int length { get; set; }
      int width { get; set; }  
  }
  </code></pre>
  
  <p>which inherits the share properties from the shape class. now I want to print a rectangle in panel . I'm familiar with <code>DrawRectangle</code> method and I printed a rectangle as bellow:</p>
  
  <pre><code>Pen black = new Pen(Color.Black);
  Rectangle rect = new Rectangle(20,20,400,200);
  private void panel1_Paint(object sender, PaintEventArgs e)
  {
      Graphics g = e.Graphics;
      g.DrawRectangle(black, rect);
  }
  </code></pre>
  
  <p>but I don't know how to draw a rectangle from <code>class rectangle:shape</code>. I'm also having problem with assigning value from click button to rectangle.
  can you please help me?</p>