2011-12-15 3 views
0

Markerbackgrounds를 메모장 ++ 플러그인으로 설정하려고합니다. 특정 줄을 강조 표시 할 수 있도록 writting하고 있습니다. 색상은 Color.ToArgb() 변환됩니다의 int로 저장됩니다 : 나는 단지 RGB 색상을 받아들이는 Scintillia 문서의 이해가 무엇에서Scintillia 마커 배경이 예상보다 다른 색으로 나옴

int colour = Convert.ToInt32(Color.LightSkyBlue.ToArgb()) 

나는의 알파 부분을 제거하기 위해 다음과 같은 기능을 사용할 수 있도록 색깔. 이것은 색상을 설정하지만 파란색 대신 나는 파란색 대신 주황색으로 표시됩니다. 이것이 마커 배경색을 설정하는 올바른 방법입니까? 모두 함께

int i = c.ToArgb(); 

:

int i = Color.FromArgb(c.R, c.G, c.B).ToArgb(); 

하지만 돈이 정수 값으로 색상을 변환

var colorOnly = Color.FromArgb(c.R, c.G, c.B); 

:

 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); 
    } 

답변

0

이는 알파 값을 제거합니다 신틸 리아가 같은 칼을 사용한다면 또는 표현. RGB 형식 대신 BGR에 값을 저장할 수 있습니다.

int bgr = (c.B * 256 + c.G) * 256 + c.R; 
+0

대단히 감사합니다. Scintillia는 BGR을 사용하여 RGB 대신 색상을 표현합니다. 이것이 내가 잘못 가고있는 부분입니다. – Kithis

관련 문제