如何将传统的(OLE)的颜色(A)RGB与.NET? [英] How to translate legacy (OLE) colors to (A)RGB with .NET?

查看:1377
本文介绍了如何将传统的(OLE)的颜色(A)RGB与.NET?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的颜色值EN codeD作为符号的整数(OLE我认为)在传统的INI文件,我需要将其转变为.NET(A)的RGB值的列表。一个ini例如:

  [INI_Section]
颜色= -2147483633
 

做这样的事情:

  Col​​or.FromArgb(-2147483633)
 

给人一种颜色,根本不是我所期望的alpha混合版本。我认为像-2147483633的值应该重新present像ButtonFace系统定义,或命名的颜色。是否有一个.NET方法正确翻译这些旧的颜色?需要注意的是的PInvoke到OLEPRO32.DLL不是一个选项。

解决方案

您可以使用ColorTranslator.FromOle做转换。
<一href="http://msdn.microsoft.com/en-us/library/system.drawing.colortranslator.fromole.aspx">http://msdn.microsoft.com/en-us/library/system.drawing.colortranslator.fromole.aspx

I have a list of color values encoded as signed integers (OLE I think) in a legacy INI file that I need to translate into (A)RGB values with .NET. An INI example:

[INI_Section]
Color=-2147483633

Doing something like:

Color.FromArgb(-2147483633)

gives an alpha-blended version of a color that is not at all what I expect. I think that a value like -2147483633 is supposed to represent a system-defined, or named color like ButtonFace. Is there a .NET method for translating these legacy colors properly? Note that pInvoke to OlePro32.dll is not an option.

解决方案

You can use ColorTranslator.FromOle to do the conversion.
http://msdn.microsoft.com/en-us/library/system.drawing.colortranslator.fromole.aspx

这篇关于如何将传统的(OLE)的颜色(A)RGB与.NET?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆