title: Draw selection Area in WinForm Application
body: <p>In my WinForm I need to draw selection area on the screen. User should be able to drag selected rectangle on corners or border to resize. As below:</p>
  
  <p><img src="https://i.stack.imgur.com/ugNfM.png" alt="enter image description here"></p>
  
  <blockquote>
    <p>I could draw the rectangle with solid brush. 
    How can I make it resizeable when dragging from border or corner?</p>
  </blockquote>
  
  <pre><code>private void panel1_MouseDown(object sender, MouseEventArgs e) {
      using (Graphics g = this.panel1.CreateGraphics()) {
          Pen pen = new Pen(Color.Black, 2);
          Brush brush = new SolidBrush(this.panel1.BackColor);
  
          g.FillRectangle(brush, this.panel1.Bounds); 
          g.DrawRectangle(pen, e.X, e.Y, 20, 20);
  
          pen.Dispose();
          brush.Dispose();
      }
  }
  </code></pre>