V
V
Vyacheslav Shabunin2020-12-06 12:39:52
C++ / C#
Vyacheslav Shabunin, 2020-12-06 12:39:52

C# | How to set a custom color value in system.drawing in Color?

I need to set setpixel to the color I want. I have a range of colors that I need for a project. But the standard ones that already have colors do not suit me. How to set color with custom value like #ffffff?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Proger5913, 2020-12-06
@fleshherbal

In your case, you can simply:

Color myColor = System.Drawing.Color.FromArgb(0xFFFFFF); //Белый цвет

Color myColor2 = System.Drawing.Color.FromArgb(0xFF0000); //Красный цвет

//То, что вы ищите :)
myBitmap.SetPixel(Xcount, Ycount, Color.FromArgb(0xFFFFFF));

The 0x prefix means that the number is written in hexadecimal format
By the way, you can find beautiful color palettes at https://flatuicolors.com

V
Vladimir Korotenko, 2020-12-06
@firedragon

Was wrong
Color.Parse('Something is there')
See
docs https://docs.microsoft.com/ru-ru/dotnet/api/system...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question