0

I downloaded a free red icon and i want to change it's color to green.

I tried this in the constructor :

public Form1()
        {
            InitializeComponent();

            var b = this.Icon.ToBitmap();
            b.SetPixel(5, 5, Color.Green);
            pictureBox1.Image = b;

but in the pictureBox1 the icon is still in red :

icon color

The top left small red icon is the one that i want to change it's color to green. This is the form1 icon. The big red icon on the right is the bitmap in pictureBox1 and it's only for testing but the color is still red.

Eliot Shein
  • 197
  • 1
  • 9
  • Just have a second image that's green and swap between them. Changing every pixel in a bitmap is pretty intensive and requires an [unsafe](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/unsafe) block. [here](https://stackoverflow.com/questions/17208254/how-to-change-pixel-color-of-an-image-in-c-net) is an example of changing bitmap pixel colors. – Jesse Jun 27 '22 at 23:30
  • The green pixel is clearly visible in the screenshot. SetPixel is not practical, use an image editor. – Hans Passant Jun 28 '22 at 01:19

0 Answers0