Quantcast
Channel: ScintillaNET Forum Rss Feed
Viewing all articles
Browse latest Browse all 296

New Post: Text property and syntax hightlight

$
0
0
Interesting... I can't reproduce your issue. I used the exact code you pasted above and when I run it, the code is added to my Form and syntax highlighting is displayed immediately. I don't have to type something in the control to get it to work. I even tried nesting the Scintilla control in a TabControl as it appears you have also done to see if that could be an issue and everything still worked fine.

Here's a couple things you could try:
  • Make sure that your tab control or parent form isn't doing anything weird in the AddControl event (or whatever) that might be affecting your Scintilla control.
  • Try adding the Scintilla control to your parent first and then setting the Scintilla properties. i.e.
ScintillaNET.Scintilla sne = new ScintillaNET.Scintilla();
pg.Controls.Add(sne);

sne.ConfigurationManager.Language = "python";
sne.Indentation.SmartIndentType = ScintillaNET.SmartIndent.Simple;
sne.TabIndex = 4;
sne.Whitespace.Mode = ScintillaNET.WhitespaceMode.VisibleAfterIndent;
sne.Text = "import sys";  
sne.Dock = DockStyle.Fill;
sne.Invalidate();

tcScripts.SelectedTabPage = pg;
  • Change sne.Invalidate() to sne.Lexing.Colorize(). Calling this method will force Scintilla to rescan the text and reapply syntax highlighting.
Jacob

Viewing all articles
Browse latest Browse all 296

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>