if(toolStripComboBox2.SelectedItem == @" Tahoma") richTextBox1.SelectionFont = new FontStyle(richTextBox1.SelectionFont.FontFamily,Tahoma); hey guys am trying to change fontstyle or textstyle of text(writing) in a rich boxi got some of these font style listed in a combobox (Arial,Cambria,Tahoma)what i want to do is when you select a textstyle i want the text in the richtextbox to be change according to the selected font in the comboboxi have already tried a few codes but some would not work and some gave me errorshere is the last code i have tried if (toolStripComboBox2.SelectedItem == @"Tahoma") richTextBox1.SelectionFont = new FontStyle(richTextBox1.SelectionFont.FontFamily, Tahoma);推荐答案 Font font_to_apply = richTextBox1.Font; font_to_apply = new Font(new FontFamily(fontNameComboBox.SelectedItem.ToString()), float.Parse(this.fontSizeComboBox.SelectedItem.ToString())); richTextBox1.SelectionFont = font_to_apply; 这篇关于更改richtextbox中文本的textstyle或fontstyle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-25 02:31