特定の行を強調表示できるように、書いているメモ帳 ++ プラグインの Markerbackgrounds を設定しようとしています。色は、Color.ToArgb() から変換される int として格納されます。
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);
}