2014-05-18 31 views
0

我的問題不僅僅是一個實際的編碼問題,而是一個根本性的問題,但它有可能以不同的字體樣式收集用戶輸入。例如,如果用戶將其他來源的以下內容複製並粘貼到表單上的文本框中;以不同的字體樣式收集用戶輸入

我跑到汽車,拿到了一包芯片。

是否可以收集它,以便字符串的每個部分都能保留其個人字體?

回答

0

當然,這是可能的。 .NET Framework提供了RichTextBox control

With the RichTextBox control, the user can enter and edit text. The control also provides more advanced formatting features than the standard TextBox control. Text can be assigned directly to the control, or can be loaded from a rich text format (RTF) or plain text file. The text within the control can be assigned character and paragraph formatting.

我肯定還有其他的第三方控件,可以做同樣的事情,更好。

+0

有沒有一種方法可以讓richtextbox接受一個副本並粘貼句子並保持該字體或斜體?我嘗試過用不同的方式進行格式化,並且每次將所有文本轉換爲單個基本格式,而不是保留一些文本斜體,有些則不是。 – user3639140

+0

這個問題已經在這裏得到解答http://stackoverflow.com/questions/5477676/c-paste-rtf-in-richtextbox-but-keep-coloring-and-formatting-i-e-bold-underl –

相關問題