Using Font Dialog to change font

Hey,

how would I make it so that one you select a font in the font dialog the font in the richtextbox changes to that font

here is what I have so far:

fontDialog1.ShowDialog();

Thanks:)




Answer this question

Using Font Dialog to change font

  • dustinto

    Hi,

    try it with the following code:

    fontDialog1.Color = richTextBoxCtrl1.ForeColor;
    if (fontDialog1.ShowDialog() != DialogResult
    .Cancel)
    {
        richTextBoxCtrl1.SelectAll(); // If you want all text with that color

       
    richTextBoxCtrl1.SelectionFont = fontDialog1.Font;
        richTextBoxCtrl1.DeSelectAll(); // If you want all text with that color
    }

    Andrej



  • bhavu

    ok thanks :)

  • Using Font Dialog to change font