2009-11-07 92 views
0

我正在構建一個簡單的應用程序,但我需要知道如何使用RichTextBox並在其上定位文本,如:center,right and left。但我怎麼能做到這一點?RichTextBox文本定位

+0

WinForms或WPF富文本框? – 2009-11-07 02:08:36

+0

對不起,WinForms。 – 2009-11-07 02:13:21

回答

3

使用SelectionAlignment屬性。詳情請參閱MSDN

1

嘗試selectionChanged屬性並將水平對齊設置爲中心,右邊或左邊。

private void richTxtBox_SelectionChanged(object sender, EventArgs e) { 
     richTxtBox.SelectionAlignment = HorizontalAlignment.Center; 
    }