Colors: Visual Basic Version

'*****************************************************************************
'                                                                            *
'  Colors.frm                                                                *
'                                                                            *
'  This program illustrates how to establish the current color for 256-color *
'  and direct color virtual buffers. It obtains the display driver's color   *
'  depth, creates a 640x480 virtual buffer with the same color depth, and    *
'  fills it with blue pixels.                                                *
'                                                                            *
'*****************************************************************************
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 bpp As Long
   ScaleMode = 3
   Call fg_setdc(hDC)
   hPal = fg_defpal()
   Call fg_realize(hPal)
   Call fg_vbinit
   bpp = fg_colors()
   Call fg_vbdepth(bpp)
   hVB = fg_vballoc(640, 480)
   Call fg_vbopen(hVB)
   Call fg_vbcolors
   If bpp > 8 Then
      Call fg_setcolorrgb(85, 85, 255)
   Else
      Call fg_setcolor(19)
   End If
   Call fg_fillpage
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

<< Prev

Next >>

Contents
Fastgraph Home Page

 

copyright 2001 Ted Gruber Software, Inc.