Reputation: 6096
So I wanna center the selected text in a richtextbox, but when i use this code it centers all the text after aswell.
public static void ChangeSelectedTextAlignment(RichTextBox control)
{
control.SelectionAlignment = HorizontalAlignment.Center;
}
How can I do so it is only the selected text which is centered. Just like word etc
Upvotes: 0
Views: 724
Reputation:
The alignment property doesn't work selection wise. It works paragraph wise, where the cursor appears in case a paragraph is not already selected.
Refer: http://msdn.microsoft.com/en-us/library/system.windows.forms.richtextbox.selectionalignment.aspx
Upvotes: 1