|
-
May 24th, 2007, 04:33 AM
#1
Thread Starter
Fanatic Member
Storing a font in database
I have a font dialogbox which allows users to choose a new font.
The problem I have is that I am not sure how to efficiently store this font in a sql server table.
Any Ideas ?
TIA
-
May 24th, 2007, 04:40 AM
#2
Re: Storing a font in database
I store a font in a database in three columns representing three properties of the Font object. The columns I name FontFamily, FontSize and FontStyle and they represent the FontFamily.Name, Size and Style properties of the Font object. Those properties are easy to get from the Font object and to save to a record and they also correspond directly to the arguments of one of the constructors of the Font class, so recreating the Font in code is also easy.
The alternative would be to serialise the Font object and save the output to a single column, the values from which you can then deserialise at a later time.
-
May 24th, 2007, 05:32 AM
#3
Thread Starter
Fanatic Member
Re: Storing a font in database
Thanks for that JMC.
I think i'm going to have to store the attributes as I don't think you can serialize a font.
Cheers
-
May 24th, 2007, 06:46 AM
#4
Re: Storing a font in database
Given that the Font class implements the ISerializable interface, I'm guessing that you can serialise a font.
-
May 24th, 2007, 06:48 AM
#5
Fanatic Member
Re: Storing a font in database
How would you go about serialising and deserialising an object that implements the ISerializable interface?
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
|