943,812 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 5521
  • VB.NET RSS
Jun 30th, 2004
0

Changeing Font Based on Reg Settings

Expand Post »
Does anyone know how to set the font Italics or bold Properties of the System.Drawing.Font Class?

Here is what I have so far and it works fine but I cannot get the Font Bold or Font Italics to work in the GetSetting Sub?

Thanks for the Help,

TrussworksLeo


#Region "Reg Settings"
Private Sub SaveSettings()

Try
'Place some settings in the registry.
SaveSetting("HBNotePad", "Startup", "Top", "75")
SaveSetting("HBNotePad", "Startup", "Left", "50")

'Font related
SaveSetting("HBNotePad", "Startup", "BackCol", Convert.ToString(textBox1.BackColor.ToArgb()))
SaveSetting("HBNotePad", "Startup", "ForeCol", Convert.ToString(textBox1.ForeColor.ToArgb()))
SaveSetting("HBNotePad", "Startup", "FontName", textBox1.Font.FontFamily.GetName(0))
SaveSetting("HBNotePad", "Startup", "FontSize", Convert.ToString(textBox1.Font.Size))
SaveSetting("HBNotePad", "Startup", "FontBol", Convert.ToBoolean(textBox1.Font.Bold))
SaveSetting("HBNotePad", "Startup", "FontItl", Convert.ToBoolean(textBox1.Font.Italic))

Catch
End Try
End Sub
Private Sub GetSettings()
Try
textBox1.Font = New System.Drawing.Font((GetSetting("HBNotePad", "Startup", "FontName", textBox1.Font.FontFamily.GetName(0))), _
Convert.ToSingle(GetSetting("HBNotePad", "Startup", "FontSize", Convert.ToString(textBox1.Font.Size))))

textBox1.ForeColor = System.Drawing.Color.FromArgb(GetSetting("HBNotePad", "Startup", "ForeCol", Convert.ToString(textBox1.ForeColor.ToArgb())))
textBox1.BackColor = System.Drawing.Color.FromArgb(GetSetting("HBNotePad", "Startup", "BackCol", Convert.ToString(textBox1.BackColor.ToArgb())))

Catch
End Try
End Sub
#End Region
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
TrussworksLeo is offline Offline
1 posts
since Jun 2004
Sep 6th, 2004
0

Re: Changeing Font Based on Reg Settings

@@@@@@@@@@@@@@@@@@@
Reputation Points: 10
Solved Threads: 0
Newbie Poster
dmohanty is offline Offline
13 posts
since Sep 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Anyone a VB.NET Guru?
Next Thread in VB.NET Forum Timeline: How To Save Documents Inside Image





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC