P
pedestrian via DotNetMonster.com
I'm trying to get all the font names (types) so I use the following code
from MSDN which entitled : "How to: Enumerate Installed Fonts"
(refer ms-help://MS.MSDNQTR.v80.en/MS.MSDN.v80/MS.VisualStudio.v80.
en/dv_fxmclignrl/html/26d74ef5-0f39-4eeb-8d20-00e66e014abe.htm)
I tried to put them in a WinForm (Form load and button click events)
however it showed 2 errors:
Error 1 Type 'InstalledFontCollection' is not defined.
Error 2 'Graphics' is not a member of 'System.EventArgs'.
I have import the System.Drawing(.Text) namespaces, What's the possible
errors and missing parts?
Thanks in advance.
Dim fontFamily As New FontFamily("Arial")
Dim font As New Font( _
fontFamily, _
8, _
FontStyle.Regular, _
GraphicsUnit.Point)
Dim rectF As New RectangleF(10, 10, 500, 500)
Dim solidBrush As New SolidBrush(Color.Black)
Dim familyName As String
Dim familyList As String = ""
Dim fontFamilies() As FontFamily
Dim installedFontCollection As New InstalledFontCollection()
' Get the array of FontFamily objects.
fontFamilies = installedFontCollection.Families
' The loop below creates a large string that is a comma-separated
' list of all font family names.
Dim count As Integer = fontFamilies.Length
Dim j As Integer
While j < count
familyName = fontFamilies(j).Name
familyList = familyList + familyName
familyList = familyList + ", "
j += 1
End While
' Draw the large string (list of all families) in a rectangle.
e.Graphics.DrawString(familyList, font, solidBrush, rectF)
--
Regards,
Pedestrian, Penang.
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/Forums.aspx/dotnet-general/200611/1
from MSDN which entitled : "How to: Enumerate Installed Fonts"
(refer ms-help://MS.MSDNQTR.v80.en/MS.MSDN.v80/MS.VisualStudio.v80.
en/dv_fxmclignrl/html/26d74ef5-0f39-4eeb-8d20-00e66e014abe.htm)
I tried to put them in a WinForm (Form load and button click events)
however it showed 2 errors:
Error 1 Type 'InstalledFontCollection' is not defined.
Error 2 'Graphics' is not a member of 'System.EventArgs'.
I have import the System.Drawing(.Text) namespaces, What's the possible
errors and missing parts?
Thanks in advance.
Dim fontFamily As New FontFamily("Arial")
Dim font As New Font( _
fontFamily, _
8, _
FontStyle.Regular, _
GraphicsUnit.Point)
Dim rectF As New RectangleF(10, 10, 500, 500)
Dim solidBrush As New SolidBrush(Color.Black)
Dim familyName As String
Dim familyList As String = ""
Dim fontFamilies() As FontFamily
Dim installedFontCollection As New InstalledFontCollection()
' Get the array of FontFamily objects.
fontFamilies = installedFontCollection.Families
' The loop below creates a large string that is a comma-separated
' list of all font family names.
Dim count As Integer = fontFamilies.Length
Dim j As Integer
While j < count
familyName = fontFamilies(j).Name
familyList = familyList + familyName
familyList = familyList + ", "
j += 1
End While
' Draw the large string (list of all families) in a rectangle.
e.Graphics.DrawString(familyList, font, solidBrush, rectF)
--
Regards,
Pedestrian, Penang.
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/Forums.aspx/dotnet-general/200611/1