コード例 #1
0
        private void ConfigureScintillaStyle(ScintillaNET.Scintilla scintilla)
        {
            var selectionColor = Color.FromArgb(255, 192, 192, 192);
            // Reset the styles
            scintilla.StyleResetDefault();
            scintilla.StyleClearAll();

            // Set the XML Lexer
            scintilla.Lexer = Lexer.Container;
            scintilla.StyleNeeded += scintilla_StyleNeeded;

            scintilla.Styles[(int)RdlScriptLexer.Style.Default].ForeColor = Color.Black;
            scintilla.Styles[(int)RdlScriptLexer.Style.Identifier].ForeColor = Color.Black;
            scintilla.Styles[(int)RdlScriptLexer.Style.Error].ForeColor = Color.Red;
            scintilla.Styles[(int)RdlScriptLexer.Style.Error].Underline = true;
            scintilla.Styles[(int)RdlScriptLexer.Style.Number].ForeColor = Color.OrangeRed;
            scintilla.Styles[(int)RdlScriptLexer.Style.String].ForeColor = Color.Brown;
            scintilla.Styles[(int)RdlScriptLexer.Style.Method].ForeColor = Color.Blue;
            scintilla.Styles[(int)RdlScriptLexer.Style.AggrMethod].ForeColor = Color.Blue;
            scintilla.Styles[(int)RdlScriptLexer.Style.AggrMethod].Bold = true;
            scintilla.Styles[(int)RdlScriptLexer.Style.UserInfo].ForeColor = Color.BlueViolet;
            scintilla.Styles[(int)RdlScriptLexer.Style.Globals].ForeColor = Color.BlueViolet;
            scintilla.Styles[(int)RdlScriptLexer.Style.Parameter].ForeColor = Color.Violet;
            scintilla.Styles[(int)RdlScriptLexer.Style.Field].ForeColor = Color.DodgerBlue;
        }
コード例 #2
0
        private void ConfigureScintillaStyle(ScintillaNET.Scintilla 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 = 40;

            // 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;
        }