Font and Color Menu controls

How to create Font and Color menus for your project

Page 1 of 1

3 Replies - 4756 Views - Last Post: 01 February 2010 - 06:47 AM Rate Topic: -----

#1 kweef19  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 108
  • Joined: 19-January 10

Font and Color Menu controls

Post icon  Posted 31 January 2010 - 02:41 PM

I'm wanting to add a Font Menu strip item and a color menu strip item to...you guessed it control the font and color of my form...I have no clue on how to do this, nor have I had any luck searching for a tutorial.
Is This A Good Question/Topic? 0
  • +

Replies To: Font and Color Menu controls

#2 LeisureProgrammer  Icon User is offline

  • N00by VB.NET Developer
  • member icon

Reputation: 110
  • View blog
  • Posts: 588
  • Joined: 06-September 09

Re: Font and Color Menu controls

Posted 31 January 2010 - 02:53 PM

For the font you can do something like this, it displays a dialog through which the user can choose his favourite font style/size/font, and then cycles through each control changing it's font.
Dim bbb As New FontDialog
		bbb.ShowDialog()
		For Each aaa As Control In Me.Controls
			aaa.Font = bbb.Font
		Next


And there are a couple of things that can mean the color of a form, I think you mean the back color, so why don't you try something like this. It displays a color dialog for the user to choose his preferred colour, and then changes the back colour to the user's preference.
Dim qqq As New ColorDialog
		qqq.ShowDialog()
		Me.BackColor = qqq.Color



Tip: Limit the user's choice of fonts, it's evil and prevents them from choosing fonts which might messup the UI or make the font so small they can't see what's written on places.

This post has been edited by LeisureProgrammer: 31 January 2010 - 03:13 PM

Was This Post Helpful? 1
  • +
  • -

#3 kweef19  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 108
  • Joined: 19-January 10

Re: Font and Color Menu controls

Posted 31 January 2010 - 10:17 PM

I see the basic idea of the font thingy...but Im still very much a vb noob and was wondering if u could be more clear on defining each font...Like do I need to use some sort of database or something to pull the fonts from or what???
Was This Post Helpful? 0
  • +
  • -

#4 LeisureProgrammer  Icon User is offline

  • N00by VB.NET Developer
  • member icon

Reputation: 110
  • View blog
  • Posts: 588
  • Joined: 06-September 09

Re: Font and Color Menu controls

Posted 01 February 2010 - 06:47 AM

To get the name of the fonts? You can extract them from Drawing.Text.Installed font collection like so:
		Dim aaa As New Drawing.Text.InstalledFontCollection
		Dim bbb As FontFamily
		For Each bbb In aaa.Families
			ListBox1.Items.Add(bbb.Name)
		Next



But if you use the fontdialog, it does all of it for you.

This post has been edited by LeisureProgrammer: 01 February 2010 - 06:47 AM

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1