.net - 为什么 Color.FromArgb(255, 255, 255, 255) != Color.White?

标签 .net gdi+

为什么 Color.FromArgb(255, 255, 255, 255) 是 不是 等于 Color.White ?是否有任何内置方法可以只比较 A、R、G、B 值而不是颜色名称?

谢谢。

最佳答案

http://msdn.microsoft.com/en-us/library/e03x8ct2(VS.85).aspx

This structure only does comparisons with other Color structures. To compare colors based solely on their ARGB values, you should use the ToArgb method. This is because the Equals and op_Equality members determine equivalency using more than just the ARGB value of the colors. For example, Black and FromArgb(0,0,0) are not considered equal, since Black is a named color and FromArgb(0,0,0) is not.

关于.net - 为什么 Color.FromArgb(255, 255, 255, 255) != Color.White?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4195134/

相关文章:

c# - Close() 后的 SqlConnection.ServerVersion 异常

c# - 从 .NET 向 Skype "group"聊天发送消息?

.net - 在 .NET 中从多边形生成位图的最快方法

c# - 从数组中检索正确的 PictureBox 图像

c++ - Win32 从设备上下文创建位图到文件和/或 BLOB

c# - 在 ASP.NET 中设置动态创建图像的内容长度

.net - NuGet:包括 .pdb 文件并排除 "Content"文件夹

c# - 如何绘制不断变化的图形

c# - 如何在图像上绘制透明形状

c# - 如何将一个图形对象复制到另一个