我需要一个特定的afont/style中的每个,问题是我正在使用而不是它没有和Forms 一样。lineRichTextBoxSystem.Windows.Controls.RichTextBoxSystem.Windows.Forms.RichTextBox.Select().SelectionFont() methods
所以我的问题是:如何在 a 中添加一行System.Windows.Controls.RichTextBox具有特定的font/style?
如果您rich text box在 WPF 中使用 WPF,请接受FlowDocument。您只需FlowDocument为每条线或世界设置样式,然后....简单示例:
<RichTextBox >
<FlowDocument>
<Paragraph>
<Span FontSize="20">first line</Span>
<LineBreak></LineBreak>
<Span Foreground="Red" FontSize="20">sec line</Span>
</Paragraph>
</FlowDocument>
</RichTextBox>