private void AddToLastColors() { var positionMultiplier = lastColorsList.Count(); var lastColor = new PictureBox() { BackColor = GetColorFromArgb(r, g, b), ForeColor = Color.FromArgb(textColor, textColor, textColor), Text = BackColor.GetHexText(), Height = 32, Width = 32 }; if (lastColorsList.Count < 15) { lastColor.Location = new Point(37 * positionMultiplier, 0); } else { lastColorsList.Clear(); lastColorsPanel.Controls.Clear(); } lastColor.Click += LoadColorFromLastColors; lastColorsList.Add(lastColor); lastColorsPanel.Controls.Add(lastColor); }