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
Printable View
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
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.
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
Given that the Font class implements the ISerializable interface, I'm guessing that you can serialise a font.
How would you go about serialising and deserialising an object that implements the ISerializable interface?