home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / VISUAL_B / ARQS_ZIP / VB-3DHOW.ZIP / 3DHOW.TXT
Encoding:
Text File  |  1992-07-19  |  5.3 KB  |  166 lines

  1. July 20, 1992
  2.  
  3.  
  4. The Following will help you create a NEXT/Grey look to all your programs
  5. without the need of any Add-Ons.  (All can be done with the tools that
  6. came with Visual Basic).
  7.  
  8. Directions:
  9.  
  10. 1- Create your application as usual
  11. 2- Write down the names of all the control on the form
  12. 3- Bring up this file with Win's NotePad, Cut and paste the individual
  13.    areas/code of this file into the appropriate areas of your program
  14.    (Some areas (Sub's) will probably have to be created).
  15.  
  16.      
  17. 4- Sub-Procedures: To create a "New Procedure", Select your form, Choose "View Code",
  18.    then choose (From the Visual Basic Menu) "CODE", "NEW PROCEDURE",
  19.    When the dialog box appears, Type the name (only the name) of the 
  20.    procedures included in this text.
  21.  
  22. 5- Procedures: The procedures (Ex: Form_Load ()) are not created, they already
  23.    exist.  Choose the control (ie., form) then choose the event (ie., Load)
  24.    from the Proc. drop down list.
  25.  
  26. ********************************************************************
  27. Copy the following to the Global.bas Module of your Application
  28. ********************************************************************
  29.  
  30. '=== Data for the Global.Bas file====
  31.  
  32. Global Const CTLRECESSED = 0   ' Frame is recessed.
  33. Global Const CTLRAISED = -1    ' Frame is raised.
  34. Global Const BKGNDGRAY = 192   ' Background Gray.
  35. Global Const DARKGRAY = 64     ' Dark Gray
  36. Global Const LIGHTGRAY = 255   ' Light Gray (white).
  37. Global Const DEFAULTWIDTH = 3  ' Default Frame Width
  38. Global FrameWidth As Integer   ' Width of 3d frame (in pixels).
  39.  
  40.  
  41. ******************************************************************************
  42.  
  43. The following are sub-routines that must be created in your
  44. form.  When you create a Sub, VB automatically creates a "SUB procedureName"
  45. and a "End Sub".  Delete the ones Created by VB after you paste in the
  46. following.
  47.  
  48. *******************************************************************************
  49.  
  50. '=====Sub Procedures ===================
  51.  
  52. *******************************************
  53. This is the Highlight sub-Procedure
  54. *******************************************    
  55.  
  56.  
  57. Sub HighLight (C As Control, InOut As Integer)
  58.     
  59. ' Convert ScaleMode of form to pixels.
  60. ' Set up colors for borders on InOut.  For recessed control:
  61. '       top & left = dark, bottom & right = left
  62. '       opposite for raised controls.
  63.     C.Parent.scalemode = 3
  64.     If InOut = CTLRAISED Then
  65.         TLShade& = RGB(LIGHTGRAY, LIGHTGRAY, LIGHTGRAY)
  66.         BRShade& = RGB(DARKGRAY, DARKGRAY, DARKGRAY)
  67.     Else
  68.         TLShade& = RGB(DARKGRAY, DARKGRAY, DARKGRAY)
  69.         BRShade& = RGB(LIGHTGRAY, LIGHTGRAY, LIGHTGRAY)
  70.     End If
  71.     
  72. ' Now draw the Frame Around the Control, on the Parent Form.
  73.     For I% = 1 To FrameWidth
  74.         T% = C.Top - I%
  75.         L% = C.Left - I%
  76.         H% = C.Height + 2 * I%
  77.         W% = C.Width + 2 * I%
  78.         C.Parent.Line (L%, T%)-Step(0, H%), TLShade&   ' left side
  79.         C.Parent.Line (L%, T%)-Step(W%, 0), TLShade&   ' top
  80.         C.Parent.Line (L% + W%, T%)-Step(0, H%), BRShade& ' right side
  81.         C.Parent.Line (L%, T% + H%)-Step(W%, 0), BRShade&  ' bottom
  82.     Next I%
  83. End Sub
  84.  
  85.  
  86.  
  87. *******************************************
  88. This is the InitCtl Sub procedure
  89. *******************************************    
  90.  
  91. Sub InitCtl (C As Control, InOut As Integer)
  92.     If TypeOf C Is HScrollBar Then      ' No BackColor for Scroll Bars
  93.     Else
  94.         C.BackColor = C.Parent.BackColor        ' Set to Forms Backcolor
  95.     End If
  96.     HighLight C, InOut
  97. End Sub
  98.  
  99.  
  100.  
  101. ******************************************************************
  102. This is the PaintFrames Sub procedure.
  103. Substitute the name for the controls on your form where my
  104. dummies ones are.  Add as many as you need.  (Make sure you
  105. leave the "InOut" spec alone.  Change only what comes after
  106. the InitCtl and up to the Comma.
  107. ******************************************************************    
  108.  
  109. Sub PaintFrames (InOut As Integer)
  110.  
  111. ' Convert All forms to Single View.
  112.     Cls  ' Remove Old Frames
  113.     'InitCtl Frame1, InOut
  114.     'InitCtl HScroll1, InOut
  115.     InitCtl Text1, InOut
  116.     InitCtl List1, InOut
  117.     InitCtl CmdGo, InOut
  118.     InitCtl CmdCancel, InOut
  119.     InitCtl CmdExit, InOut
  120.     InitCtl Dir1, InOut
  121.     InitCtl Drive1, InOut
  122.     'InitCtl Check1, InOut
  123.     'InitCtl Check2, InOut
  124.     'InitCtl Picture1, InOut
  125.     
  126. ' Other elements that need initialization (option Boxes).
  127.     'Option1.BackColor = BackColor
  128.     'Option2.BackColor = BackColor   'remove the ' if needed.
  129.     'Picture1.Refresh                ' Repaint Picture Box
  130. End Sub
  131.  
  132.  
  133.  
  134. ****************************************************************
  135. This is the Form_Load Procedure.  Copy it to the Form_Load
  136. event of your form. (Can be appended to what is already there
  137. *****************************************************************    
  138.  
  139.  
  140. '=======Main Form Procedures
  141.  
  142. Sub Form_Load ()
  143.     
  144.     BackColor = RGB(BKGNDGRAY, BKGNDGRAY, BKGNDGRAY)
  145.     FrameWidth = DEFAULTWIDTH
  146.     
  147. End Sub
  148.  
  149.  
  150. ****************************************************************
  151. This is the Form_Paint Procedure.  This is where you control
  152. the look.  Either Raised or Recessed.
  153. ****************************************************************    
  154.  
  155. Sub Form_Paint ()
  156.     'PaintFrames CTLRAISED
  157.      PaintFrames CTLRECESSED
  158. End Sub
  159.  
  160.  
  161.  
  162. ################### The end
  163.  
  164.  
  165.  
  166.