0
我正在尝试为记事本++插件设置Markerbackgrounds我正在写这样某些行可以突出显示。颜色被存储为从Color.ToArgb()转换整数:Scintillia标记背景出现不同于预期的颜色
int colour = Convert.ToInt32(Color.LightSkyBlue.ToArgb())
从我明白了Scintillia文档它只接受RGB颜色的,所以我使用下面的函数,以汽提出的阿尔法部颜色。这确实设置了颜色,但不是蓝色,而是变成橙色而不是蓝色。这是设置标记背景颜色的正确方法吗?
private static void DefineColor(int type, int colour)
{
string hexValue = colour.ToString("X");
hexValue = hexValue.Remove(0, 2);
//hexValue = "0x" + hexValue
int decValue = Convert.ToInt32(ColorTranslator.FromHtml(hexValue));
//int decValue = int.Parse("FF", System.Globalization.NumberStyles.AllowHexSpecifier);
Win32.SendMessage(PluginBase.nppData._scintillaMainHandle, SciMsg.SCI_MARKERDEFINE, type, (int)SciMsg.SC_MARK_BACKGROUND);
Win32.SendMessage(PluginBase.nppData._scintillaMainHandle, SciMsg.SCI_MARKERSETBACK, type, decValue);
Win32.SendMessage(PluginBase.nppData._scintillaMainHandle, SciMsg.SCI_MARKERSETFORE, type, 0);
}
非常感谢。 Scintillia确实使用BGR来表示它的颜色而不是RGB,这就是我出错的地方。 – Kithis 2011-12-16 09:40:27