home *** CD-ROM | disk | FTP | other *** search
- July 20, 1992
-
-
- The Following will help you create a NEXT/Grey look to all your programs
- without the need of any Add-Ons. (All can be done with the tools that
- came with Visual Basic).
-
- Directions:
-
- 1- Create your application as usual
- 2- Write down the names of all the control on the form
- 3- Bring up this file with Win's NotePad, Cut and paste the individual
- areas/code of this file into the appropriate areas of your program
- (Some areas (Sub's) will probably have to be created).
-
-
- 4- Sub-Procedures: To create a "New Procedure", Select your form, Choose "View Code",
- then choose (From the Visual Basic Menu) "CODE", "NEW PROCEDURE",
- When the dialog box appears, Type the name (only the name) of the
- procedures included in this text.
-
- 5- Procedures: The procedures (Ex: Form_Load ()) are not created, they already
- exist. Choose the control (ie., form) then choose the event (ie., Load)
- from the Proc. drop down list.
-
- ********************************************************************
- Copy the following to the Global.bas Module of your Application
- ********************************************************************
-
- '=== Data for the Global.Bas file====
-
- Global Const CTLRECESSED = 0 ' Frame is recessed.
- Global Const CTLRAISED = -1 ' Frame is raised.
- Global Const BKGNDGRAY = 192 ' Background Gray.
- Global Const DARKGRAY = 64 ' Dark Gray
- Global Const LIGHTGRAY = 255 ' Light Gray (white).
- Global Const DEFAULTWIDTH = 3 ' Default Frame Width
- Global FrameWidth As Integer ' Width of 3d frame (in pixels).
-
-
- ******************************************************************************
-
- The following are sub-routines that must be created in your
- form. When you create a Sub, VB automatically creates a "SUB procedureName"
- and a "End Sub". Delete the ones Created by VB after you paste in the
- following.
-
- *******************************************************************************
-
- '=====Sub Procedures ===================
-
- *******************************************
- This is the Highlight sub-Procedure
- *******************************************
-
-
- Sub HighLight (C As Control, InOut As Integer)
-
- ' Convert ScaleMode of form to pixels.
- ' Set up colors for borders on InOut. For recessed control:
- ' top & left = dark, bottom & right = left
- ' opposite for raised controls.
- C.Parent.scalemode = 3
- If InOut = CTLRAISED Then
- TLShade& = RGB(LIGHTGRAY, LIGHTGRAY, LIGHTGRAY)
- BRShade& = RGB(DARKGRAY, DARKGRAY, DARKGRAY)
- Else
- TLShade& = RGB(DARKGRAY, DARKGRAY, DARKGRAY)
- BRShade& = RGB(LIGHTGRAY, LIGHTGRAY, LIGHTGRAY)
- End If
-
- ' Now draw the Frame Around the Control, on the Parent Form.
- For I% = 1 To FrameWidth
- T% = C.Top - I%
- L% = C.Left - I%
- H% = C.Height + 2 * I%
- W% = C.Width + 2 * I%
- C.Parent.Line (L%, T%)-Step(0, H%), TLShade& ' left side
- C.Parent.Line (L%, T%)-Step(W%, 0), TLShade& ' top
- C.Parent.Line (L% + W%, T%)-Step(0, H%), BRShade& ' right side
- C.Parent.Line (L%, T% + H%)-Step(W%, 0), BRShade& ' bottom
- Next I%
- End Sub
-
-
-
- *******************************************
- This is the InitCtl Sub procedure
- *******************************************
-
- Sub InitCtl (C As Control, InOut As Integer)
- If TypeOf C Is HScrollBar Then ' No BackColor for Scroll Bars
- Else
- C.BackColor = C.Parent.BackColor ' Set to Forms Backcolor
- End If
- HighLight C, InOut
- End Sub
-
-
-
- ******************************************************************
- This is the PaintFrames Sub procedure.
- Substitute the name for the controls on your form where my
- dummies ones are. Add as many as you need. (Make sure you
- leave the "InOut" spec alone. Change only what comes after
- the InitCtl and up to the Comma.
- ******************************************************************
-
- Sub PaintFrames (InOut As Integer)
-
- ' Convert All forms to Single View.
- Cls ' Remove Old Frames
- 'InitCtl Frame1, InOut
- 'InitCtl HScroll1, InOut
- InitCtl Text1, InOut
- InitCtl List1, InOut
- InitCtl CmdGo, InOut
- InitCtl CmdCancel, InOut
- InitCtl CmdExit, InOut
- InitCtl Dir1, InOut
- InitCtl Drive1, InOut
- 'InitCtl Check1, InOut
- 'InitCtl Check2, InOut
- 'InitCtl Picture1, InOut
-
- ' Other elements that need initialization (option Boxes).
- 'Option1.BackColor = BackColor
- 'Option2.BackColor = BackColor 'remove the ' if needed.
- 'Picture1.Refresh ' Repaint Picture Box
- End Sub
-
-
-
- ****************************************************************
- This is the Form_Load Procedure. Copy it to the Form_Load
- event of your form. (Can be appended to what is already there
- *****************************************************************
-
-
- '=======Main Form Procedures
-
- Sub Form_Load ()
-
- BackColor = RGB(BKGNDGRAY, BKGNDGRAY, BKGNDGRAY)
- FrameWidth = DEFAULTWIDTH
-
- End Sub
-
-
- ****************************************************************
- This is the Form_Paint Procedure. This is where you control
- the look. Either Raised or Recessed.
- ****************************************************************
-
- Sub Form_Paint ()
- 'PaintFrames CTLRAISED
- PaintFrames CTLRECESSED
- End Sub
-
-
-
- ################### The end
-
-
-
-