Created
January 3, 2025 01:36
-
-
Save jcouture100/fb6c9d1fd0fe34917fa9981b93e740a2 to your computer and use it in GitHub Desktop.
ScintillaNET XML Recipe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Reset the styles | |
scintilla.StyleResetDefault(); | |
scintilla.Styles[Style.Default].Font = "Consolas"; | |
scintilla.Styles[Style.Default].Size = 10; | |
scintilla.StyleClearAll(); | |
// Set the XML Lexer | |
scintilla.Lexer = Lexer.Xml; | |
// Show line numbers | |
scintilla.Margins[0].Width = 20 ; | |
// Enable folding | |
scintilla.SetProperty("fold", "1"); | |
scintilla.SetProperty("fold.compact", "1"); | |
scintilla.SetProperty("fold.html", "1"); | |
// Use Margin 2 for fold markers | |
scintilla.Margins[2].Type = MarginType.Symbol; | |
scintilla.Margins[2].Mask = Marker.MaskFolders; | |
scintilla.Margins[2].Sensitive = true; | |
scintilla.Margins[2].Width = 20; | |
// Reset folder markers | |
for (int i = Marker.FolderEnd; i <= Marker.FolderOpen; i++) | |
{ | |
scintilla.Markers[i].SetForeColor(SystemColors.ControlLightLight); | |
scintilla.Markers[i].SetBackColor(SystemColors.ControlDark); | |
} | |
// Style the folder markers | |
scintilla.Markers[Marker.Folder].Symbol = MarkerSymbol.BoxPlus; | |
scintilla.Markers[Marker.Folder].SetBackColor(SystemColors.ControlText); | |
scintilla.Markers[Marker.FolderOpen].Symbol = MarkerSymbol.BoxMinus; | |
scintilla.Markers[Marker.FolderEnd].Symbol = MarkerSymbol.BoxPlusConnected; | |
scintilla.Markers[Marker.FolderEnd].SetBackColor(SystemColors.ControlText); | |
scintilla.Markers[Marker.FolderMidTail].Symbol = MarkerSymbol.TCorner; | |
scintilla.Markers[Marker.FolderOpenMid].Symbol = MarkerSymbol.BoxMinusConnected; | |
scintilla.Markers[Marker.FolderSub].Symbol = MarkerSymbol.VLine; | |
scintilla.Markers[Marker.FolderTail].Symbol = MarkerSymbol.LCorner; | |
// Enable automatic folding | |
scintilla.AutomaticFold = AutomaticFold.Show | AutomaticFold.Click | AutomaticFold.Change; | |
// Set the Styles | |
scintilla.StyleResetDefault(); | |
// I like fixed font for XML | |
scintilla.Styles[Style.Default].Font = "Courier"; | |
scintilla.Styles[Style.Default].Size = 10; | |
scintilla.StyleClearAll(); | |
scintilla.Styles[Style.Xml.Attribute].ForeColor = Color.Red; | |
scintilla.Styles[Style.Xml.Entity].ForeColor = Color.Red; | |
scintilla.Styles[Style.Xml.Comment].ForeColor = Color.Green; | |
scintilla.Styles[Style.Xml.Tag].ForeColor = Color.Blue; | |
scintilla.Styles[Style.Xml.TagEnd].ForeColor = Color.Blue; | |
scintilla.Styles[Style.Xml.DoubleString].ForeColor = Color.DeepPink; | |
scintilla.Styles[Style.Xml.SingleString].ForeColor = Color.DeepPink; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment