Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试转换int从数据库中获取的一个 RBG 代码(没有格式,例如 111000111 而不是 111,000,111)并尝试将其转换为十六进制数。
int
有谁知道我会怎么做?
您可以使用FromArgb方法:
int number = 111000111; Color c = Color.FromArgb(number); string hex = string.Format("{0:x}{1:x}{2:x}", c.R, c.G, c.B);