Beispiel #1
0
        private void Form1_Load(object sender, System.EventArgs e)
        {
            SyntaxHighlightingTextBox shtb = new SyntaxHighlightingTextBox();
            shtb.Location = new Point(0, 0);
            shtb.Dock = DockStyle.Fill;
            shtb.Seperators.Add(' ');
            shtb.Seperators.Add('\r');
            shtb.Seperators.Add('\n');
            shtb.Seperators.Add(',');
            shtb.Seperators.Add('.');
            shtb.Seperators.Add('-');
            shtb.Seperators.Add('+');
            //shtb.Seperators.Add('*');
            //shtb.Seperators.Add('/');
            Controls.Add(shtb);
            shtb.WordWrap = false;
            shtb.ScrollBars = RichTextBoxScrollBars.Both;// & RichTextBoxScrollBars.ForcedVertical;

            /*shtb.HighlightDescriptors.Add(new HighlightDescriptor("<", Color.Gray, null, DescriptorType.Word, DescriptorRecognition.WholeWord, true));

            shtb.HighlightDescriptors.Add(new HighlightDescriptor("<<", ">>", Color.DarkGreen, null, DescriptorType.ToCloseToken, DescriptorRecognition.StartsWith, false));
            */
            shtb.HighlightDescriptors.Add(new HighlightDescriptor("Hello", Color.Red, null, DescriptorType.Word, DescriptorRecognition.Contains));
            shtb.HighlightDescriptors.Add(new HighlightDescriptor("Hellofatime", Color.Green, null, DescriptorType.Word, DescriptorRecognition.WholeWord));
            shtb.HighlightDescriptors.Add(new HighlightDescriptor("Helsinky", Color.Maroon, null, DescriptorType.Word, DescriptorRecognition.WholeWord));
            shtb.HighlightDescriptors.Add(new HighlightDescriptor("World", Color.Blue, null, DescriptorType.Word, DescriptorRecognition.WholeWord));
            shtb.HighlightDescriptors.Add(new HighlightDescriptor("/*", "*/", Color.Magenta, null, DescriptorType.ToCloseToken, DescriptorRecognition.StartsWith));
        }
 private void SetKeywords(SyntaxHighlightingTextBox control)
 {
     //control.HighlightDescriptors.Add(new HighlightDescriptor("\\{=string.trim", "", "", Color.Blue, null));
     //control.HighlightDescriptors.Add(new HighlightDescriptor("\\{=string", "", "", Color.Blue, null));
     foreach (string item in tagsList)
     {
         control.HighlightDescriptors.Add(new HighlightDescriptor("\\{=" + Regex.Escape(item), "", "", Color.Blue, null));
     }
     control.HighlightDescriptors.Add(new HighlightDescriptor("\\{=", "", "", Color.Magenta, null));
     control.HighlightDescriptors.Add(new HighlightDescriptor("\\}", @"\{=.*", "", Color.Magenta, null));
     control.HighlightDescriptors.Add(new HighlightDescriptor("\"", "\\.", "", Color.Magenta, null));
     control.HighlightDescriptors.Add(new HighlightDescriptor("\"", "", @"\\cf. \\}|^\.", Color.Magenta, null));
     control.HighlightDescriptors.Add(new HighlightDescriptor("//.*", "", "", Color.Green, null));
 }
 private void SetSeperators(SyntaxHighlightingTextBox control)
 {
     control.Seperators.Add('\r');
     control.Seperators.Add('\n');
 }
 public void Add(SyntaxHighlightingTextBox richTextBox)
 {
     list.Add(richTextBox);
     if (ControlAdded != null)
     {
         ControlAdded(richTextBox, null);
     }
 }