How to change the RichTextBox input current font?
input something and change combox value to change
FontFamily/FontSize/FontColor that I have selected.
Now change ComBox value without selection . and then I input something I
hope new iput effect
how to do? i have use this.richTextBox.FontSize =
Convert.ToDouble(this.sizeComboBox.SelectedItem);
this.richTextBox.Document.FontFamily = new
FontFamily(e.AddedItems[0].ToString()); the tow method have change all
document enter //X‰üš'Ì'å¬ private void
sizeComBox_SelectionChanged(object sender, SelectionChangedEventArgs e) {
if (!richTextBox.Selection.IsEmpty) {
richTextBox.Selection.ApplyPropertyValue(RichTextBox.FontSizeProperty,
sizeComboBox.SelectedValue.ToString()); } else { this.richTextBox.FontSize
= Convert.ToDouble(this.sizeComboBox.SelectedItem);
//this.richTextBox.SetValue(TextElement.FontSizeProperty,
Convert.ToDouble(this.sizeComboBox.SelectedItem)); } }here
No comments:
Post a Comment