Fonts

darknuke

Well-known member
Joined
Oct 3, 2003
Messages
68
I am using an .ini file to save application settings, and I would like a way to set the font. The font on textBox returns [Font: Name=Lucida Console, Size=9.75, Units=3, GdiCharSet=0, GdiVerticalFont=False].

Unfortunately textBox.Font = "[Font: Name=Lucida Console, Size=9.75, Units=3, GdiCharSet=0, GdiVerticalFont=False]", does not work.

I thought of making a separate variable for each value to read (size, font-family, style, etc), but the values on textBox are read only :(!

Is there any way I can set the font?
 
why not just save the Fonts name rather than the whole font to your .ini ie... ( save the textBox.Font.Name )
then ...
Code:
        Dim fontname As String = "Tahoma" /// the fontname from your .ini here.
        TextBox1.Font = New Font(fontname, TextBox1.Font.Size, TextBox1.Font.Style)
 
Because I am trying to make it as identical to Notepad as I can get (or want to get), then work off and add features from there. I guess Ill just have to deal work off Font + Size, since Style cant be a string read from the ini. (I tried the same thing you posted already)

Thanks anyways!
 
Back
Top