AFont() Method



|Visual FoxPro Toolkit for .NET | |

AFont() Method

Returns a array containing a list of all the fonts installed in the system.

[pic]

[Visual Basic]

Public Shared Function AFont(ByRef aArray() As String) As Integer

[C#]

public static int AFont(out string[] aArray)

Example

[Visual Basic]

Dim MyFontsArr() As String

Dim nTotalFonts As Integer = AFonts(MyFontsArr)

[C#]

string[] MyFontsArr;

int nTotalFonts = VFPToolkit.arrays.AFonts(out MyFontsArr);

Implementation

[Visual Basic]

Public Shared Function AFont(ByRef aArray() As String) As Integer

'

'Note: You could return the FontFamily array and use the font objects directy and it would make things easier

'Initialize the InstalledFontCollection object

Dim fc As InstalledFontCollection = New InstalledFontCollection()

'Create an empty FontFamily array and fill it up

Dim afm() As FontFamily

afm = fc.Families

'RE Initialize a string array

aArray = New String(afm.Length) {}

'loop through the array of fonts and fill the font names

Dim i As Integer = 0

For i = 0 To afm.Length - 1 Step i + 1

aArray.SetValue(afm(i).Name, i)

Next

'Return the number of fonts

Return i + 1

End Function

[C#]

public static int AFont(out string[] aArray)

{

//

//Note: You could return the FontFamily array and use the font objects directy and it would make things easier

//Initialize the InstalledFontCollection object

InstalledFontCollection fc = new InstalledFontCollection();

//Create an empty FontFamily array and fill it up

FontFamily[] afm;

afm = fc.Families;

//RE Initialize a string array

aArray = new string[afm.Length];

//loop through the array of fonts and fill the font names

int i = 0;

for (i=0; i< afm.Length; i++)

{

aArray.SetValue(afm[i].Name, i);

}

//Return the number of fonts

return i + 1;

}

Requirements

Namespace: VFPToolkit

Class: VFPToolkit.arrays

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows .NET Server family

Assembly: VFPToolkit (in VFPToolkitNET.dll)

See Also

VFPToolkit.arrays Members | VFPToolkit Namespace

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download