|
-
Apr 15th, 2003, 12:02 AM
#1
Thread Starter
Addicted Member
Font remembering
Hey,
Is there a way that i can have my program remember the font, size and style. that the user selects.
I am using the FontDialog How would i go about setting the font so that each time the program loads it uses the font propertys the user selected that last time they used it.
Thanks
-
Apr 15th, 2003, 03:19 AM
#2
Sleep mode
Save those properties in reg key or any simple file and restor them when loading your prog.
-
Apr 15th, 2003, 07:58 AM
#3
Fanatic Member
Could you serialize the Control to XML and just Deserialize it to get your settings when the app loads?
-
Apr 15th, 2003, 08:05 AM
#4
Sleep mode
Originally posted by VBCrazyCoder
Could you serialize the Control to XML and just Deserialize it to get your settings when the app loads?
Yeah , I think this ideal . but what I was talking about is that he can save font.tostring in a file then import it and convert it into font object .
-
Apr 15th, 2003, 11:43 AM
#5
Thread Starter
Addicted Member
Dim y As FontFamily
"i have a textbox and the line 2nd line has the name of the font to be used.
Dim test
test = txtfontprop.Lines(1)
y = test
txtLyrics.Font = New System.Drawing.Font(y, 25.0!, FontStyle.Regular)
this doens't work do you know how i can get this to work?
or could you provide a sample ?
Thanks
-
Apr 15th, 2003, 12:04 PM
#6
Sleep mode
Try this :
VB Code:
Save "fntstr" this to file
Dim fntstr As String =TextBox.Font.ToString()
'get the font string from the file and do some conversions like this
Dim fnt As New FontConverter()
Dim fntobj As Font = Nothing
fntobj = fnt.ConvertFromString(fntstr)
'assign the font to the control
TextBox1.Font = fntobj
-
Apr 15th, 2003, 01:51 PM
#7
Thread Starter
Addicted Member
thanks...but..
I get this error Size=14.25 is not valid value for units
the size doesn't matter it does it on any size
thanks alot
-
Apr 15th, 2003, 02:17 PM
#8
Thread Starter
Addicted Member
fixed it
VB Code:
Save "fntstr" this to file
Dim fntstr As String
Dim fnt As New FontConverter()
fntstr = fnt.ConvertToString(txtLyrics.Font)
'get the font string from the file and do some conversions like this
Dim fnt As New FontConverter()
Dim fntobj As Font = Nothing
fntobj = fnt.ConvertFromString(fntstr)
'assign the font to the control
TextBox1.Font = fntobj
This seems to work... Thanks alot for your help !
-
Apr 15th, 2003, 05:49 PM
#9
Sleep mode
Re: fixed it
Glad you got it working .
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|