Get a list of System Font Sizes
-
I want to have a dropdown combo box with a list of font sizes(point size) for the user to select from. The combo box is to be like that used in MS word etc. Is there a way to do this for any c# built in call or should I create the list myself by supplying the values to the combo box. Regards Jeff.
-
I want to have a dropdown combo box with a list of font sizes(point size) for the user to select from. The combo box is to be like that used in MS word etc. Is there a way to do this for any c# built in call or should I create the list myself by supplying the values to the combo box. Regards Jeff.
You could at least search the CP articles before asking, even if you do nothing else!! FontComboBox - a font listing combo box for .NET[^]
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
You could at least search the CP articles before asking, even if you do nothing else!! FontComboBox - a font listing combo box for .NET[^]
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
Does this article somehow work out what font sizes are valid tho ? I googled, and it seemed to me that you couldn't work that out, so I didn't reply ( because I figured that someone else may know a way that I could not find )
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
I want to have a dropdown combo box with a list of font sizes(point size) for the user to select from. The combo box is to be like that used in MS word etc. Is there a way to do this for any c# built in call or should I create the list myself by supplying the values to the combo box. Regards Jeff.
There is no "list of system font sizes" A font is size independant - you can use it at anny size you want 8, 8.25, 400, 73. You list box should just contain common sizes, and allow the user to select uncommon ones.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones
-
Does this article somehow work out what font sizes are valid tho ? I googled, and it seemed to me that you couldn't work that out, so I didn't reply ( because I figured that someone else may know a way that I could not find )
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
:-O It was late, I was tired, what can I say. My eyes totally skipped the size part of the question.
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
There is no "list of system font sizes" A font is size independant - you can use it at anny size you want 8, 8.25, 400, 73. You list box should just contain common sizes, and allow the user to select uncommon ones.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones
-
I want to have a dropdown combo box with a list of font sizes(point size) for the user to select from. The combo box is to be like that used in MS word etc. Is there a way to do this for any c# built in call or should I create the list myself by supplying the values to the combo box. Regards Jeff.
it's very easy. C# code //get system fonts InstalledFontCollection MyFont=new InstalledFontCollection(); FontFamily[] MyFontFamilies=MyFont.Families; int Count=MyFontFamilies.Length; for(int i=0;i <Count;i++) { string FontName=MyFontFamilies[i].Name; this.comboBox1.Items.Add(FontName); } of course,I remember Win32 API have the funcation to get them.
-
There is no "list of system font sizes" A font is size independant - you can use it at anny size you want 8, 8.25, 400, 73. You list box should just contain common sizes, and allow the user to select uncommon ones.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones
What that would appear true in theory, not all fonts can be rendered at all point sizes. For example, consider a Label "label1" with initial font "Microsoft Sans Serif" at point size 8.25.
Font f = new Font(label1.Font.FontFamily, label1.Font.SizeInPoints + 0.5f); label1.Font = f; label1.Text = label1.Font.SizeInPoints.ToString();
Execute that code a few times (at least on my WinXP machine) via a button click or whatever, and the font's appearance at 9.25 and 9.75 are identical, as are 10.75 and 11.25, etc. Also, there is obviously some mapping going on, setting the font size to 8.0 results in 8.25, 10.0 to 9.75, etc. Is there any way of knowing, short of trial and error, if changing the point size by some amount will actually have impact on what is rendered?