FGFW1: Visual Basic Version
'*****************************************************************************
' *
' FGFW1.frm *
' *
' Demonstrate the basic Fastgraph/Fonts for Windows operations of font *
' loading, character display and justification, and font unloading. *
' *
'*****************************************************************************
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 xMax As Long, yMax As Long
Dim xMid As Long, yMid As Long
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
If fgf_load(App.Path & "\AUSTIN36.FGF") = 0 Then
Call MsgBox("Unable to load font file.", vbCritical, "Error")
Unload Me
Exit Sub
End If
xMax = fg_getmaxx()
yMax = fg_getmaxy()
xMid = xMax / 2
yMid = yMax / 2
Call fg_setcolor(255)
Call fg_fillpage
Call fg_setcolor(19)
Call fg_move(0, 0)
Call fgf_justify(-1, 1)
Call fgf_print("FG/Fonts", 8)
Call fg_move(xMid, 0)
Call fgf_justify(0, 1)
Call fgf_print("FG/Fonts", 8)
Call fg_move(xMax, 0)
Call fgf_justify(1, 1)
Call fgf_print("FG/Fonts", 8)
Call fg_move(0, yMid)
Call fgf_justify(-1, 0)
Call fgf_print("FG/Fonts", 8)
Call fg_move(xMid, yMid)
Call fgf_justify(0, 0)
Call fgf_print("FG/Fonts", 8)
Call fg_move(xMax, yMid)
Call fgf_justify(1, 0)
Call fgf_print("FG/Fonts", 8)
Call fg_move(0, yMax)
Call fgf_justify(-1, -1)
Call fgf_print("FG/Fonts", 8)
Call fg_move(xMid, yMax)
Call fgf_justify(0, -1)
Call fgf_print("FG/Fonts", 8)
Call fg_move(xMax, yMax)
Call fgf_justify(1, -1)
Call fgf_print("FG/Fonts", 8)
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 fgf_unload(-1)
Call fg_vbclose
Call fg_vbfree(hVB)
Call fg_vbfin
End Sub
|