static void SetButtonColor(ButtonBase button, int argb) { const int ImageWidth = 20; var image = new IndexedImage { Size = new Size(ImageWidth, ImageWidth) }; ImagePainter.FillRect(image, new Rectangle(0, 0, ImageWidth, ImageWidth), argb); var oldBitmap = button.Image; button.Image = image.ToBitmap(); oldBitmap?.Dispose(); button.Tag = argb; }