Click here to Skip to main content
15,882,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi !!

I am working on a project using C# where I need a technique to get the alignment property value of certain line in a richtextbox control

I do not mind to use other text editing controls other than richtextbox but I need efficient solution

so please help me or give me the advise and thanks.

for example:

C#
foreach (var Line in richTextBox1.Text)
{
    // I want to get the text alignment for each Line
}
Posted

1 solution

Hi,
If this is going to be only the alignment in RichTextBox then refer this link,
http://msdn.microsoft.com/en-us/library/system.windows.forms.richtextbox.selectionalignment.aspx[^]

Hope it helps.
 
Share this answer
 
Comments
[no name] 4-Nov-13 8:18am    
Thanks, but I need to get the alignment of each line in my text ..
Thomas ktg 4-Nov-13 8:22am    
use something like this and try
int lineCounter = 0;
foreach(string line in richTextBox1.Lines)
{
//add conditional statement if not selecting all the lines
richTextBox.Select(richTextBox.GetFirstCharIndexFromLine(lineCounter), line.Length);
richTextBox.SelectionColor = Color.Red;
lineCounter++;
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900