直接看转换方法吧
public static string Rgb216(int r,int g,int b){
return System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.FromArgb(r,g,b));
}
使用方法
String color = Rgb216(255,0,0); System.Console.WriteLine(color);
本文介绍了一种将RGB颜色值转换为16进制颜色字符串的方法,并提供了一个简单的C#示例函数。该函数利用了System.Drawing.Color类中的静态方法ToHtml,将输入的红色、绿色和蓝色分量值转化为标准的HTML颜色格式。
57

被折叠的 条评论
为什么被折叠?



