Strings1: Visual Basic Version
'*****************************************************************************
' *
' Strings1.frm *
' *
' This program shows how to display strings in the client area. *
' *
'*****************************************************************************
Const vbWidth = 320
Const vbHeight = 240
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()
ScaleMode = 3
Call fg_setdc(hDC)
hPal = fg_defpal()
Call fg_realize(hPal)
Call fg_vbinit
hVB = fg_vballoc(vbWidth, vbHeight)
Call fg_vbopen(hVB)
Call fg_vbcolors
Call fg_setcolor(24)
Call fg_fillpage
End Sub
Private Sub Form_Paint()
Call fg_vbscale(0, vbWidth - 1, 0, vbHeight - 1, 0, cxClient - 1, 0, cyClient - 1)
Call fg_setcolor(19)
' upper vertical justification
Call fg_move(fg_xclient(0), fg_yclient(0))
Call fg_justify(-1, 1)
Call fg_print("FG/Windows", 10)
Call fg_move(fg_xclient(vbWidth / 2), fg_yclient(0))
Call fg_justify(0, 1)
Call fg_print("FG/Windows", 10)
Call fg_move(fg_xclient(vbWidth - 1), fg_yclient(0))
Call fg_justify(1, 1)
Call fg_print("FG/Windows", 10)
' centered vertical justification
Call fg_move(fg_xclient(0), fg_yclient(vbHeight / 2))
Call fg_justify(-1, 0)
Call fg_print("FG/Windows", 10)
Call fg_move(fg_xclient(vbWidth / 2), fg_yclient(vbHeight / 2))
Call fg_justify(0, 0)
Call fg_print("FG/Windows", 10)
Call fg_move(fg_xclient(vbWidth - 1), fg_yclient(vbHeight / 2))
Call fg_justify(1, 0)
Call fg_print("FG/Windows", 10)
' lower vertical justification
Call fg_move(fg_xclient(0), fg_yclient(vbHeight - 1))
Call fg_justify(-1, -1)
Call fg_print("FG/Windows", 10)
Call fg_move(fg_xclient(vbWidth / 2), fg_yclient(vbHeight - 1))
Call fg_justify(0, -1)
Call fg_print("FG/Windows", 10)
Call fg_move(fg_xclient(vbWidth - 1), fg_yclient(vbHeight - 1))
Call fg_justify(1, -1)
Call fg_print("FG/Windows", 10)
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
|