for(int i=1;i<rtb.Lines.Length;i++){if(rtb.Lines[i] == rtb.Lines[i - 1]){int bg = rtb.GetFirstCharIndexFromLine(i);//获得当前行起始位置rtb.Select(bg, rtb.Lines[i].Length);rtb.SelectionColor = Color.Red;}}