What I am trying to do is after a event happens i set all my arrow pictures to purple.
Here is what my arrow picture looks like before drawing:
Here is what it looks like after drawing:
First I make a list of all the pictureboxes with the arrow:
List<PictureBox> arrows = new List<PictureBox>();
foreach (var item in Controls.OfType<PictureBox>())
{
if (item.Name.StartsWith("arrow"))
{
arrows.Add(item);
}
}
And this is the code I use to color the pictures:
System.Drawing.Color purple = System.Drawing.Color.Purple;
foreach (var item in arrows)
{
Bitmap bmp = new Bitmap(item.Image, item.Height, item.Width);
for (int i = 0; i < item.Height; i++)
{
for (int j = 0; j < item.Width; j++)
{
var actualColor = bmp.GetPixel(i, j).ToArgb();
var purpleA = bmp.GetPixel(i, j).A;
if (actualColor != System.Drawing.Color.White.ToArgb())
{
bmp.SetPixel(i, j, System.Drawing.Color.FromArgb(purpleA, purple));
} else
{
bmp.SetPixel(i, j, System.Drawing.Color.FromArgb(actualColor));
}
}
}
item.Image = bmp;
}
How can I color the image accurately? At the moment the purple is really badly drawn. I need it to be the exact same as the black arrow but instead of black I need it to be purple.
Note: I resize the black arrow image when I put it in the picturebox, so on the form the black and the purple arrow are the same size. I uploaded the purple arrow with a screenshot and the black arrow was from my computer. That's why they are not the same size.