Converting from RGB ints to Hex

前端 未结 5 964
野的像风
野的像风 2021-02-12 11:00

What I have is R:255 G:181 B:178, and I am working in C# (for WP8, to be more specific)

I would like to convert this to a hex number to use as a color (to set the pixel

5条回答
  •  面向向阳花
    2021-02-12 11:46

    Try the below:

    using System.Drawing;
    Color myColor = Color.FromArgb(255, 181, 178);
    string hex = myColor.R.ToString("X2") + myColor.G.ToString("X2") + myColor.B.ToString("X2");
    

提交回复
热议问题