private void FixScintillaStyles(ScintillaTextEditorCustom scintilla) { // 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 = 35; // 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; }
private void FixScintillaStyles(ScintillaTextEditorCustom scintilla) { // Reset the styles scintilla.StyleResetDefault(); scintilla.Styles[Style.Default].Font = "Consolas"; scintilla.Styles[Style.Default].Size = 10; scintilla.StyleClearAll(); // Show line numbers scintilla.Margins[0].Width = 30; }