コード例 #1
0
ファイル: OpitonsDialog.cs プロジェクト: MykolaKovalchuk/SAE5
        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;
        }