2011-07-27 100 views
1

我有一些來自數據庫的字符串(段落)。我需要給每個字符串一個單獨的格式,如着色,粗體和斜體等。問題是,我僅限於使用單個Rich文本框。C#富文本框樣式

我的問題的解決方案是什麼?

感謝

+0

當然可以做到。你有什麼嘗試? – BugFinder

回答

0

對於要應用樣式,請選擇該字符串,然後應用所需的樣式每個字符串。如:

richTextBox1.Text = "Hi this is a string"; 
richTextBox1.Select(0, 2);//selects Hi 
richTextBox1.SelectionColor = Color.Red;//make its color red 
richTextBox1.SelectionFont = new Font("Arial", 15, FontStyle.Bold); apply arial font to it and make it bold