home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 26 / CD_ASCQ_26_1295.iso / vrac / pzdemo.zip / PZDEMO.BAS < prev    next >
BASIC Source File  |  1995-08-18  |  4KB  |  103 lines

  1. Option Explicit
  2.  
  3. ' declare a few API functions that we will be using
  4. Declare Sub WinHelp Lib "User" (ByVal hWnd As Integer, ByVal lpHelpFile As String, ByVal wCommand As Integer, ByVal dwData As Long)
  5. Declare Function GetDeviceCaps Lib "GDI" (ByVal hDC As Integer, ByVal nIndex As Integer) As Integer
  6. Declare Sub FlashWindow Lib "User" (ByVal hWnd As Integer, ByVal bInvert As Integer)
  7.  
  8. ' GetDeviceCaps constants
  9. Global Const BITSPIXEL = 12
  10. Global Const CAPS1 = 94            ' other caps
  11. Global Const C1_TRANSPARENT = 1    ' new raster cap
  12. Global Const NEWTRANSPARENT = 3    ' use with SetBkMode()
  13.  
  14.  
  15. '-----------------------------------
  16. 'Common Dialog Control
  17. '-----------------------------------
  18. 'Action Property
  19. Global Const DLG_FILE_OPEN = 1
  20. Global Const DLG_FILE_SAVE = 2
  21. Global Const DLG_COLOR = 3
  22. Global Const DLG_FONT = 4
  23. Global Const DLG_PRINT = 5
  24. Global Const DLG_HELP = 6
  25.  
  26. 'Color Dialog Flags
  27. Global Const CC_RGBINIT = &H1&
  28. Global Const CC_FULLOPEN = &H2&
  29. Global Const CC_PREVENTFULLOPEN = &H4&
  30. Global Const CC_SHOWHELP = &H8&
  31.  
  32. Sub CenterForm (F As Form)
  33.     ' put the form in the center of the screen
  34.     F.Move (screen.Width - F.Width) \ 2, (screen.Height - F.Height) \ 2
  35. End Sub
  36.  
  37. Sub SetBevelOptions (F As Form, T As PZPanel)
  38. '*******************************************************
  39. '*                                                     *
  40. '*   Set the bevel and border of a panel to the values *
  41. '*   stored within the tags of a dialog form.          *
  42. '*                                                     *
  43. '*******************************************************
  44.  
  45.     ReDim opt(1) As Integer
  46.     Dim i As Integer
  47.     
  48.     T.BevelOuter = Val(F!Tabs(0).Tag)
  49.     T.BevelInner = Val(F!Tabs(1).Tag)
  50.     T.BorderOuter = Val(F!Tabs(2).Tag)
  51.     T.BorderInner = Val(F!Tabs(3).Tag)
  52.     T.BevelOuterWidth = Val(F!WidthLab(0))
  53.     T.BevelInnerWidth = Val(F!WidthLab(1))
  54.     T.BorderOuterWidth = Val(F!WidthLab(2))
  55.     T.BorderInnerWidth = Val(F!WidthLab(3))
  56.     For i = 0 To 1
  57.         opt(i) = Val(F!ColorOpt(i * 2 + 1).Tag)
  58.         opt(i) = opt(i) + Val(F!ColorOpt(i * 2).Tag) Xor (opt(i) < 2) And 1
  59.     Next
  60.     T.BevelOuterShading = opt(0)
  61.     T.BevelInnerShading = opt(1)
  62.  
  63.     T.BorderOuterColor = Val(F!ColorOpt(5).Tag)
  64.     T.BorderInnerColor = Val(F!ColorOpt(7).Tag)
  65. End Sub
  66.  
  67. Sub ShowBevelOptions (F As Form, T As PZPanel)
  68. '*******************************************************
  69. '*                                                     *
  70. '*   Store the bevel and border settings of a panel    *
  71. '*   within the tags of a dialog form.                 *
  72. '*                                                     *
  73. '*******************************************************
  74.  
  75.     ReDim opt(1) As Integer
  76.     Dim i As Integer
  77.     
  78.     F!TabPan.Tag = "0" ' set the "up" tab
  79.     F!Tabs(0).Tag = Str$(T.BevelOuter)
  80.     F!Tabs(1).Tag = Str$(T.BevelInner)
  81.     F!Tabs(2).Tag = Str$(T.BorderOuter)
  82.     F!Tabs(3).Tag = Str$(T.BorderInner)
  83.     F!WidthLab(0) = Str$(T.BevelOuterWidth)
  84.     F!WidthLab(1) = Str$(T.BevelInnerWidth)
  85.     F!WidthLab(2) = Str$(T.BorderOuterWidth)
  86.     F!WidthLab(3) = Str$(T.BorderInnerWidth)
  87.  
  88.     ' setting the bevel shade options is confusing because
  89.     ' the "white light" option reverses its value depending
  90.     ' on the "black shade" option
  91.     opt(0) = T.BevelOuterShading
  92.     opt(1) = T.BevelInnerShading
  93.     For i = 0 To 1
  94.         ' there are four color option buttons, two for each property
  95.         F!ColorOpt(i * 2).Tag = Str$((opt(i) < 2 Xor opt(i)) And 1)
  96.         F!ColorOpt(i * 2 + 1).Tag = Str$(opt(i) And 2)
  97.     Next
  98.  
  99.     F!ColorOpt(5).Tag = Str$(T.BorderOuterColor)
  100.     F!ColorOpt(7).Tag = Str$(T.BorderInnerColor)
  101. End Sub
  102.  
  103.