korky
asked on
FONT
How can I retreive what size a font supports?
i am not understanding you.. but try something like this?
control.fontsize = 12
label1.Font = "Times New Roman"
label1.FontSize = 10
control.fontsize = 12
label1.Font = "Times New Roman"
label1.FontSize = 10
i meant control = text1, label1, etc.
ASKER
What I mean is:
When I, for exemple in WordPad want to change the fontsize of a selected word, I am proposed a list of available size. System has only one size: 10 when Times New Roman has from 8 to 72...
What I am lookink for is a way to get that list.
When I, for exemple in WordPad want to change the fontsize of a selected word, I am proposed a list of available size. System has only one size: 10 when Times New Roman has from 8 to 72...
What I am lookink for is a way to get that list.
try to give you a comment.
get any control from the toolbox on the form. click one time on that control so it brings the property window. click on the font. you will see the list of the fontsize.
get any control from the toolbox on the form. click one time on that control so it brings the property window. click on the font. you will see the list of the fontsize.
ASKER
You still don't get it I want to get the list to show it to my users so they can format their text in a rich edit control.
oh ok.. i am sorry for misunderstanding your problem. any comments/suggestions for korky.
all the best.
all the best.
Most Fonts are True-Type fonts. Basically it means that they are scaleable. So any size is OK within the range up to 2160. A practical limit is 8 to 72 points like Word or Excel. You can use the TextWidth function to see what sizes will cause a change in the width of the text. There may be some differences based on the object (Picture1, Screen or Printer).
Dim I As Integer
For I = 0 To Screen.FontCount - 1
Picture1.Font = Screen.Fonts(I)
Debug.Print Picture1.Font, Picture1.FontSize
z = Picture1.TextWidth("X")
For x = 7 To 72
Picture1.FontSize = x
If Picture1.TextWidth("X") <> z Then
Debug.Print Picture1.FontSize
z = Picture1.TextWidth("X")
End If
Next x
Next I
Dim I As Integer
For I = 0 To Screen.FontCount - 1
Picture1.Font = Screen.Fonts(I)
Debug.Print Picture1.Font, Picture1.FontSize
z = Picture1.TextWidth("X")
For x = 7 To 72
Picture1.FontSize = x
If Picture1.TextWidth("X") <> z Then
Debug.Print Picture1.FontSize
z = Picture1.TextWidth("X")
End If
Next x
Next I
ASKER
That's not really what I'm looking for... But thanks for your time.
I know the list exists but don't know how to make it work...
I know the list exists but don't know how to make it work...
Tell me more about this list?
ASKER
Take a look at wordpad:
- Write Something
- Select it
- Change the font to system
- And take a look at the font size combo...
The only proposed size is 10. On the other hand if you had chosen Times New Roman you would have found list from 8 to 72 font size combo.
That list is what I am looking for.
- Write Something
- Select it
- Change the font to system
- And take a look at the font size combo...
The only proposed size is 10. On the other hand if you had chosen Times New Roman you would have found list from 8 to 72 font size combo.
That list is what I am looking for.
Hi! This(the program below) is not very practical...but you can modify it.
I display the list of font size in a text box(text1) with multiline=true. You can change
this into combo box or whatever you want.
Dim info(100) As Integer
lfcr = Chr(13) + Chr(10)
Text1.Font.size = 1
info(0) = Text1.Font.size
For i = 2 To 100 Step 1
Text1.Font.size = i
info(i) = Text1.Font.size
If info(i) <> info(i - 1) Then
size = size + Str(info(i)) + lfcr
End If
Next
Text1.Font.size = 1
Text1.Text = size
End Sub
I display the list of font size in a text box(text1) with multiline=true. You can change
this into combo box or whatever you want.
Dim info(100) As Integer
lfcr = Chr(13) + Chr(10)
Text1.Font.size = 1
info(0) = Text1.Font.size
For i = 2 To 100 Step 1
Text1.Font.size = i
info(i) = Text1.Font.size
If info(i) <> info(i - 1) Then
size = size + Str(info(i)) + lfcr
End If
Next
Text1.Font.size = 1
Text1.Text = size
End Sub
ASKER
This was very nice but not really what I was looking for...
For "system" I get:
10
20
29
39
49
58
68
78
While all I should get should be: 10
For "system" I get:
10
20
29
39
49
58
68
78
While all I should get should be: 10
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER