This site include tutorials of VB.Net programming

Sunday, March 7, 2010

Use of font dialog box and colour dialog box

  • Create new project and add a form.
  • Drag and Drop two command buttons and a Label to the form.
  • Then drag & drop a FontDialog and a ColorDialog to the form.
  • change the Name property of the buttons & Label as cmdFont, cmdColor and lblShow.
  • Change the Text property of the buttons & Label as Change Font, Change Color and Show

  • Double click on the change font button. write the following two lines.
FontDialog1.ShowDialog()
lblShow.Font = FontDialog1.Font

  • Double click on the change Color button. write the following two lines.
ColorDialog1.ShowDialog()
lblShow.ForeColor = ColorDialog1.Color

  • Run the Application by clicking at > or by pressing F5. Click on button and change fonts and colors.

No comments:

Post a Comment