开发者

Cannot Style ScintillaNet Text after or before syntax coloring

var scin = new Scintilla();
ScintillaHotspotStyle = scin.Styles.LastPredefined.Index + 1;
scin.Margins[0].Width = 20;
scin.Caret.HighlightCurrentLine = true;

scin.Styles[ScintillaHotspotStyle].IsHotspot = true;
scin.Styl开发者_如何学JAVAes[ScintillaHotspotStyle].Underline = true;
scin.Styles[ScintillaHotspotStyle].ForeColor = System.Drawing.Color.Blue;

var contents = File.ReadAllText(file);
scin.Text = contents;

//scin.ConfigurationManager.Language = "cpp";
//scin.ConfigurationManager.Configure();

scin.GetRange(2, 5).SetStyle(ScintillaHotspotStyle);

//scin.ConfigurationManager.Language = "cpp";
//scin.ConfigurationManager.Configure();

It doesn't matter which order of the commented lines, nor if the call to .Configure() is performed - the outcome is the same:

Cannot Style ScintillaNet Text after or before syntax coloring

If however, I do not apply the syntax highlighting, it does work:

Cannot Style ScintillaNet Text after or before syntax coloring

Scintilla is pretty confusing, so I'm probably doing something wrong - but I'm not sure what...


I think that the syntax hiliting is applied after your job. Or like if you read the scintilla documentation it seems than hotspot style have restricted feature.

""" Caret, selection, and hotspot styles

The selection is shown by changing the foreground and/or background colours. If one of these is not set then that attribute is not changed for the selection. The default is to show the selection by changing the background to light gray and leaving the foreground the same as when it was not selected. When there is no selection, the current insertion point is marked by the text caret. This is a vertical line that is normally blinking on and off to attract the users attention. """

Did you try to force the style hiliting in an area which are not syntactically hilited ? Near main or print as an example.

And try it by setting a background color.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜