This project is read-only.

Margin Colors

Jan 14, 2012 at 6:00 PM
Edited Jan 14, 2012 at 6:34 PM

I've been trying to change the margin (numbers) back & fore colors. But it does not work.

This is what i have:


'Scintilla control
Friend WithEvents SyntaxHandler As Scintilla

SyntaxHandler = New Scintilla()

SyntaxHandler.Name = "SyntaxHandler" & If(Instances.Count = 0, "", Instances.Count)
_Handle = GetControlHandleByName(.Name, Main)

'Here is where i try to change the margin colors
SendMessage(_Handle, Constants.SCI_STYLESETBACK, Constants.STYLE_DEFAULT, &HFF0000)
SendMessage(_Handle, Constants.SCI_STYLESETFORE, Constants.STYLE_DEFAULT, &HFFFFFF)
SendMessage(_Handle, Constants.SCI_SETMARGINTYPEN, 1, SC_MARGIN_BACK)

'GetControlHandleByName Function
Public Function GetControlHandleByName(ByVal Name As String, ByVal CurrentForm As Form) As IntPtr
    Dim info As System.Reflection.FieldInfo = CurrentForm.GetType().GetField("_" & Name, System.Reflection.BindingFlags.NonPublic Or System.Reflection.BindingFlags.Instance Or System.Reflection.BindingFlags.Public Or System.Reflection.BindingFlags.IgnoreCase)
    If info Is Nothing Then
        Return Nothing
        Return CType(info.GetValue(CurrentForm), Control).Handle
    End If
End Function

'constants i define from the scintilla source (not the Net one)
Public Const SC_MARGIN_BACK As UInteger = 2
Public Const SC_MARGIN_FORE As UInteger = 3


I know the code is a bit disordered but it's a class that's why.


Does anyone know why this is not working?

Jan 28, 2012 at 10:56 AM
Edited Jan 28, 2012 at 10:56 AM


now i've change that code to this:


SyntaxHandle.NativeInterface.SetFoldMarginColour(False, Microsoft.VisualBasic.RGB(Color.White.R, Color.White.G, Color.White.B))
SyntaxHandle.NativeInterface.StyleSetBack(Constants.STYLE_LINENUMBER, Microsoft.VisualBasic.RGB(Color.White.R, Color.White.G, Color.White.B))


but i still have that gray color on the margins.


can someone help me please

Jan 28, 2012 at 4:21 PM

Are you using the release version, or did you create a build from the repo? I'm not sure , but this may be an issue that was fixed in the repo, where the fold margin's background color wasn't getting set correctly.

Jan 29, 2012 at 12:00 AM

I did download the version from the main page and build it myself to add a builtin languaje (pawn)