CSMemo028

リッチテキストボックスの中のコメント行を色づけする


       private void Coloring()
       {
           string[] lines = richTextBox1.Text.Split('\n');
           int i = 0;
           int totalLength = 0;
           foreach (string line in lines)
           {
               int index = line.IndexOf("#");
               if (index > -1)
               {
                   richTextBox1.Select(totalLength + index, line.Length - index);
                   richTextBox1.SelectionColor = System.Drawing.Color.Blue;
               }
               totalLength += line.Length + 1;
               i++;
           }
           richTextBox1.Select(totalLength, 0);
       }
最終更新:2011年07月30日 11:12