2011-03-01 16 views

Respuesta

0

bien, entonces tal vez esto (found here):

private void richTextBox1_MouseClick(object sender, MouseEventArgs e, Color color) 
{ 
    int firstcharindex = richTextBox1.GetFirstCharIndexOfCurrentLine(); 
    int currentline = richTextBox1.GetLineFromCharIndex(firstcharindex); 
    string currentlinetext = richTextBox1.Lines[currentline]; 
    richTextBox1.SelectionBackColor = color; 
    richTextBox1.Select(firstcharindex, currentlinetext.Length); 
} 

este fragmento debe resolver su problema ;-)

1

No, primero hay que seleccionar la línea, entonces usted tiene que establecer el color :

public void MarkSingleLine() 
{ 
    int firstCharOfLineIndex = myRichTextBox.GetFirstCharIndexOfCurrentLine(); 
    int currentLine = richTextBox1.GetLineFromCharIndex(firstCharOfLineIndex); 
    this.myRichTextBox.Select(firstCharOfLineIndex, currentLine); 
    this.myRichTextBox.SelectionBackColor = Color.Aqua; 
    this.myRichTextBox.Select(0, 0); 
} 
Cuestiones relacionadas