FGFW4: Visual Basic Version
'*****************************************************************************
' *
' FGFW4.frm *
' *
' Demonstrate manual font loading. *
' *
'*****************************************************************************
Const FontFileSize = 8258
Dim hPal As Long
Dim hVB As Long
Dim cxClient As Long, cyClient As Long
Private Sub Form_Activate()
Call fg_realize(hPal)
Refresh
End Sub
Private Sub Form_Load()
Dim FontArray() As Byte
ScaleMode = 3
Call fg_setdc(hDC)
hPal = fg_defpal()
Call fg_realize(hPal)
Call fg_vbinit
hVB = fg_vballoc(640, 480)
Call fg_vbopen(hVB)
Call fg_vbcolors
On Error Resume Next
Call FileLen(App.Path & "\MODERN28.FGF")
If Err.Number > 0 Then
Call MsgBox("Unable to open font file.", vbCritical, "Error")
Unload Me
Exit Sub
End If
ReDim FontArray(FontFileSize)
Open App.Path & "\MODERN28.FGF" For Binary Access Read As #1
Get #1, , FontArray
Close #1
Call fgf_define(FontArray(0))
Call fg_setcolor(255)
Call fg_fillpage
Call fg_setcolor(19)
Call fg_move(fg_getmaxx() / 2, fg_getmaxy() / 2)
Call fgf_justify(0, 0)
Call fgf_print("FG/Fonts", 8)
Erase FontArray
End Sub
Private Sub Form_Paint()
Call fg_vbscale(0, fg_getmaxx(), 0, fg_getmaxy(), 0, cxClient - 1, 0, cyClient - 1)
End Sub
Private Sub Form_Resize()
cxClient = ScaleWidth
cyClient = ScaleHeight
Refresh
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call fg_vbclose
Call fg_vbfree(hVB)
Call fg_vbfin
End Sub
|