title: How to handle mouse event
body: <p>I want to click inside a square and then an "X" should appear, but I'm not sure what to put inside the <code>Form1_MouseDown</code>, <code>Form1_Paint</code> and <code>Form1_MouseUp</code> events. How can I implement this is C#?</p>
  
  <pre><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 VTest
  {
      public partial class Form1 : Form
      {
          Rectangle rect; // single rect
          int sqsize, n;
          int margin;
  
          public Form1()
          {
              n = 3;
              margin = 25;
              sqsize = 50;
              rect = new Rectangle(10, 10, 150, 150);
              InitializeComponent();
          }
  
          private void Form1_MouseDown(object sender, MouseEventArgs e)
          {
              // what goes here?
          }
  
          private void Form1_Paint(object sender, PaintEventArgs e)
          {
              // what goes here?
          }
  
          private void Form1_MouseUp(object sender, MouseEventArgs e)
          {
              // what goes here?
          }
  
          // ...
  </code></pre>