How can I get the Font
object for the default system font used by the particular device? I've noticed that different devices have different resolutions and DPIs, but some of my controls have explicitly defined fonts. I'd like to be able to get the default system font at runtime (as if I never changed the Font
property on the control).
views:
99answers:
1
A:
Have you looked into System.Drawing.SystemFonts? I think it may have what you need.
http://msdn.microsoft.com/en-us/library/system.drawing.systemfonts_members.aspx
Edit: I just noticed the CF tag. You will need to look at the registry to get the system font information.
TheHurt
2009-12-15 19:19:51
Do you have any idea on how to convert the values in the registry into a Font object? That is, how do you convert the 'Ht' and 'Wt' into appropriate values for the Font constructor?
Jason
2009-12-15 21:07:32
Since the Ht is in pixels you would need to convert it:points = pixels * (72 / dpi)As far as the Wt, I am not sure. The range of values is pretty wide. You may have to pick a cutoff and say anything below is normal and anything above is bold.
TheHurt
2009-12-15 22:17:39