I am building a graph using the following code. I need to be able to change the color of any given rectangle by clicking on it with the mouse. I am, so far, unable to find a way to accomplish this.

Any ideas would be greatly appreciated. 

```
    int number;
    public List<Rectangle> listRec = new List<Rectangle>();
    Graphics g;

    public CrochetPtrnDesign()
    {
        InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
        try
        {
            number = int.Parse(textBox1.Text);
            Rectangle rect = new Rectangle();
            listRec.Clear();
            rect.Size = new Size((pnlDesign.Width - 1) / number, (pnlDesign.Height - 1) / number);
            for (int x = 0; x < number; x++)
            {
                rect.X = x * rect.Width;
                for (int y = 0; y < number; y++)
                {
                    rect.Y = y * rect.Height;
                    listRec.Add(rect);
                }
            }
        }
        catch
        {
            MessageBox.Show("Please enter a number...");
        }
        foreach (Rectangle rec in listRec)
        {
            g = pnlDesign.CreateGraphics();
            Pen p = new Pen(Color.Black);
            g.DrawRectangle(p, rec);
        }
    }

```