Live Chat Icon For mobile
Live Chat Icon

How do I use the FontDialog class to set a control’s font

Platform: WinForms| Category: Common Dialogs

It is straight-forward. Create an instance of the class and call its ShowDialog method.


     FontDialog fontDialog1 = new FontDialog(); 
      fontDialog1.ShowColor = true; 
      if(fontDialog1.ShowDialog() != DialogResult.Cancel ) 
      { 
           textBox1.Font = fontDialog1.Font ; 
           textBox1.ForeColor = fontDialog1.Color; 
      } 
  
     textBox1.Text = 'this is a test'; 

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.