Kbase P185841: How to generate a list of fonts installed on a Windows system using .NET classes?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  4/13/2011 |
|
Status: Unverified
GOAL:
How to generate a list of fonts installed on a Windows system using .NET classes?
GOAL:
How to generate a list of fonts installed on the Windows operating system?
GOAL:
How to generate a list of fonts installed on a Windows system?
FACT(s) (Environment):
OpenEdge 10.2x
Windows
FIX:
Example code to generate a list of fonts installed on a Windows system using .NET:
USING System.Drawing.Text.*.
DEFINE VARIABLE osFonts AS System.Drawing.Text.InstalledFontCollection NO-UNDO.
DEFINE VARIABLE osFontEnum AS System.Collections.IEnumerator NO-UNDO.
DEFINE VARIABLE osFont AS System.Drawing.FontFamily NO-UNDO.
DEFINE VARIABLE i AS INTEGER NO-UNDO.
osFonts = NEW System.Drawing.Text.InstalledFontCollection().
osFontEnum = osFonts:Families:GetEnumerator().
osFontEnum:Reset().
DO i = 0 TO osFonts:Families:length - 1:
osFontEnum:MoveNext().
osFont = CAST(osFontEnum:Current, System.Drawing.FontFamily).
MESSAGE osFont:Name
VIEW-AS ALERT-BOX.
DELETE OBJECT osFont.
END.
IF VALID-OBJECT(osFonts) THEN DELETE OBJECT osFonts.
IF VALID-OBJECT(osFontEnum) THEN DELETE OBJECT osFontEnum.