如何将十六进制颜色转换为RGB颜色(24位) [英] How to convert Hexadecimal Color to RGB color (24 Bit)
本文介绍了如何将十六进制颜色转换为RGB颜色(24位)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用C#和asp.net 4。
I use C# and asp.net 4.
如何在等效的RGB颜色中转换和十六进制颜色?
How to convert and Hexadecimal Color in an equivalent RGB Color?
Example: FF0000 to 255,0,0.
我的目标是将此颜色传递给FromArgb命名空间System.Drawing
My aim is to pass this color to the method FromArgb namespace System.Drawing
FromArgb Method (Int32, Int32, Int32) (Alpha is implicit as opaque)
此刻,我使用以下代码清除和成像并应用不透明的纯色:
At the moment I use this code to Clear and Image and apply a opaque flat color:
System.Drawing.Graphics.Clear(System.Drawing.Color.Red));
此功能可以很好地使用预定义的颜色,例如红色,黑色等,但效果不明显
This works fine with predefined color like "Red", "Black" and so on, but not obviously with a Custom more precise color.
有什么想法吗?谢谢您的帮助!
Any ideas? Thanks for your help!
资源:
http://msdn.microsoft.com/en-us/library/cce5h557.aspx
http://msdn.microsoft.com /en-us/library/system.drawing.color.aspx
推荐答案
您为什么不这样做
System.Drawing.Color myColor = System.Drawing.Color.FromArgb(0xFF0000);
这篇关于如何将十六进制颜色转换为RGB颜色(24位)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文