Hi guys,

could somebody here tell me how to color the current text line in richTextBox Object, or where can I search for this feature???

Thanks

[EL-Prince]

Look at RichTextBox.Select() , see if the code below helps:

// The draw back to this is if a line wraps it will continue the 
// selection until a newline char is found.
int startIndex = myRtfEdit.GetFirstCharIndexOfCurrentLine();
int selectionLength = myRtfEdit.Text.IndexOf('\n', startIndex) - startIndex;
if(selectionLength > 0) myRtfEdit.Select(startIndex, selectionLength);

Hi,
Thanks about answering my question, but actually this NOT what I want.
What I want is highlight or coloring the current row of text in richTextBox object, not selecting text.

Thanks

[EL-Prince]

Actually it is key to what you want to do. To do most things in a RichTextBox you need to select the text you wish to alter so selecting that text can be the most complicated part.

with the above in mind consider the following:

myRtfEdit.SelectionColor = Color.Blue;
myRtfEdit.SelectionFont = myFont;
myRtfEdit.SelectionBackColor = Color.Gray;
myRtfEdit.DeselectAll();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.