I am trying to simulate a LED display board with c# . I need a `control` which contains 1536 clickable `control`s to simulate LEDs (96 in width and 16 in Height). I used a `panel` named `pnlContainer` for this and user will add 1536 tiny customized `panel`s at runtime. These customized `panel`s should change their color by click event at runtime. Everything works . But adding this number of tiny `panel`s to the container takes long time ( about 10 secs). What is your suggestion to solve this issue? Any tips are appreciated.

this is my custome `panel`:

```
public partial class LedPanel : Panel
{
    public LedPanel()
    {
        InitializeComponent();
    }

    protected override void OnPaint(PaintEventArgs pe)
    {
        base.OnPaint(pe);

    }

    protected override void OnMouseDown(MouseEventArgs e)
    {
        if (e.Button == MouseButtons.Left)
        {
            if (this.BackColor == Color.Black)
            {
                this.BackColor = Color.Red;
            }
            else
            {
                this.BackColor = Color.Black;
            }
        }
    }
}

```

and this is piece of code which adds tiny `panel`s to the `pnlContainer` :

```
private void getPixels(Bitmap img2)
    {

        pnlContainer.Controls.Clear();

        for (int i = 0; i < 96; i++)
        {
            for (int j = 0; j < 16; j++)
            {

                Custom_Controls.LedPanel led = new Custom_Controls.LedPanel();
                led.Name = i.ToString() + j.ToString();
                int lWidth = (int)(pnlContainer.Width / 96);
                led.Left = i * lWidth;
                led.Top = j * lWidth;
                led.Width = led.Height = lWidth;
                if (img2.GetPixel(i, j).R>numClear.Value)
                {
                    led.BackColor = Color.Red;
                }
                else
                {
                    led.BackColor = Color.Black;
                }
                led.BorderStyle = BorderStyle.FixedSingle;

                pnlContainer.Controls.Add(led);

            }
        }

    }

```

[![application is very slow at runtime](https://i.stack.imgur.com/RAbg5.jpg)](https://i.stack.imgur.com/RAbg5.jpg)

Is there any better approach or better `control` instead of `panel`to do this?