How change backcolor from multiple lines?

Topics: Developer Forum, User Forum
Aug 12, 2010 at 5:42 PM

the title say everything...

i need change the background color of multiple lines in the scintillanet.

not is current (caret) line background color. is in the others lines.

this is possible?

if yes, how do that?

 

thank you in advance for help

Coordinator
Aug 13, 2010 at 7:37 PM

What you are looking for are Line Markers

//  First define the marker. Usually they have some kind 
//  of symbol to show in the margin but we can set it to 
//  only change the background color of the line
Marker marker = scintilla.Markers[0];
marker.Symbol = MarkerSymbol.Background;
marker.BackColor = Color.Green;
            
//  Add 3 lines
scintilla.Text = "This is \r\n a test.\r\nThis is only a test";

//  Go ahead and add the marker to all 3 lines. This sets a 
//  background color that overrides the styles'
scintilla.Lines[0].AddMarker(marker);
scintilla.Lines[1].AddMarker(marker);
scintilla.Lines[2].AddMarker(marker);

//  And to clear the background color unset the marker
scintilla.Lines[1].DeleteMarker(marker);

In this example lines 0 and 2 will have a green background

Aug 17, 2010 at 2:36 PM
Edited Aug 17, 2010 at 2:37 PM

i will try.

 

thank's

Nov 14, 2010 at 2:05 AM

Hi.

 

How can I change the forecolor instead of background? I tried to make

marker.ForeColor = Color.Green;

but didn't worked!

Can you help me?

Thanks
daniela

Nov 21, 2010 at 4:22 AM

Maybe you have to set the UseForeColor property of the Scintilla control to true.

Nov 24, 2010 at 9:22 PM

Doesn't worked. It makes all lines Black.