In my application, i want user to select a font, from a list of fonts available in user's system and set that font to richtextbox. I tried ::
System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
foreach (FontFamily family in fonts.Families)
{
comboBox1.Items.Add(family.Name);
}
and
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
richTextBox1.Font = new Font(comboBox1.SelectedText, 14);
}
but it changes the default behaviour of the text. For example: text includes headings in bold and italics. Setting the font with above code transforms the text in the regular form. My question is, to possibly keep the behaviour of the text as before and not to change the complete text in regular form by keeping the bold text in bold and italics in italics.