home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 22
/
CD_ASCQ_22_0695.iso
/
win
/
prg
/
ptcm10
/
sample
/
1.cmx
next >
Wrap
Text File
|
1995-02-25
|
7KB
|
183 lines
"Power Toolz Code Manager snippet samples."
" ■0.00■Misc VB routines used to demonstrate the features in PTCM.■Chris Haynes■1099 Mason Rd.■Ashby■MA■01431■ 1■This is a sample PTCM library. ■ 4■SAMPLE.BMP■SAMPLE.HLP"
""
" Centerform routine. Used to center a form on the screen."
'+-------------------------------------------------|PT AutoDoc|-------+
'| |
'|Name: centerform Revision: 1.00 Date: 12-29-1994 |
'| |
'|Author: Chris Haynes |
'| |
'|Operation: Used to center the specified form on the screen. |
'| |
'|Parameters Passed: |
'| f As Form: Form to center on the screen. |
'| |
'| |
'| Copyright (C) 1994, All Rights Reserved |
'+--------------------------------------------------------------------+
'
Sub centerform (f As Form)
Sw% = screen.Width
Sh% = screen.Height
f.Top = (Sh% \ 2) - (f.Height \ 2)
f.Left = (Sw% \ 2) - (f.Width \ 2)
End Sub
" Input_box routine. Used as a replacement for inputbox. >>Form=INBOX.FRM"
'+-------------------------------------------------|PT AutoDoc|-------+
'| |
'|Name: input_box Revision: 1.00 Date: 12-29-1994 |
'| |
'|Author: Chris Haynes |
'| |
'|Operation: Used to load the inbox form, used as an alternitive to in|
'| |
'|Parameters Passed: |
'| message As String: The message to display in the input box (use|
'| |
'| Return value: A string containing text typed by the user. |
'| |
'| Copyright (C) 1994, All Rights Reserved |
'+--------------------------------------------------------------------+
'
Function input_box (message As String)
Load inbox
inbox.Tag = message
inbox.Show 1
input_box = inbox.Tag
Unload inbox
Set inbox = Nothing
End Function
" MakeCtrl3D, used to make a normal text box 3D."
'---------------------------------------------------------------------
'Routine Name: makectrl3d Written: 6/2/94 Author: Chris Haynes
'
'Purpose: Used to give textboxes, listboxes, dir & file boxes a 3D effect.
' set autoredraw to true before calling this routine.
'
'Parameters: Control name
' Form name
'
'API Declarations: none
'
'Data Structures: none
'
'Constants: none
'
' Copyright 1994, Chris Haynes [Unauthorized use prohibited]
'---------------------------------------------------------------------
Sub makectrl3d (c As Control, f As Form)
f.ScaleMode = 3 '----- Scale in Pixels
f.ForeColor = &H0 '----- black
'----- Initialize main variables
x% = c.Left - 1
y% = c.Top - 1
w% = c.Width + x%
h% = c.Height + y%
'----- black lines on top and left size
f.Line (x%, h%)-(x%, y%)
f.Line (x%, y%)-(w% + 1, y%)
'----- dk grey top bevel
f.ForeColor = &H808080
f.Line (x% - 1, h% + 2)-(x% - 1, y% - 1)
f.Line -(w% + 3, y% - 1)
'----- white lines on bottom
f.ForeColor = &HFFFFFF
f.Line (x%, h% + 2)-(w% + 2, h% + 2)
f.Line -(w% + 2, y% - 1)
End Sub
" MakeLabel3D, used to make normal labels 3D."
'---------------------------------------------------------------------
'Routine Name: MakeLabel3D Written: 6/8/94 Author: Chris Haynes
'
'Purpose: Add a 3D border to a label
'
'Parameters: form and control names. Bevelwidth in pixels. style 0 = raised
' 1 = sunken
'
'API Declarations: none
'
'Data Structures: none
'
'Constants: none
'
' Copyright 1994, Chris Haynes [Unauthorized use prohibited]
'---------------------------------------------------------------------
Sub makelabel3d (f As Form, c As Control, bevelwidth As Integer, pstyle As Integer)
f.ScaleMode = 3 'scale in pixels
Dim ptop As Integer
Dim pleft As Integer
Dim pwidth As Integer
Dim pheight As Integer
ptop = c.Top - bevelwidth
pleft = c.Left - bevelwidth
pwidth = c.Width + pleft + bevelwidth + bevelwidth
pheight = c.Height + ptop + bevelwidth + bevelwidth
If pstyle = 0 Then
f.ForeColor = &HFFFFFF ' white color
Else
f.ForeColor = &H808080
End If
bevelwidth = bevelwidth - 1
f.Line (pleft, ptop)-(pleft + bevelwidth, pheight), , BF
f.Line (pleft, ptop)-(pwidth, bevelwidth + ptop), , BF
If pstyle = 0 Then
f.ForeColor = &H808080
Else
f.ForeColor = &HFFFFFF
End If
f.DrawWidth = 1
'----- Draw bottom bevel
x% = 0
For l% = 0 To bevelwidth
f.Line (pleft + l%, pheight - x%)-(pwidth, pheight - x%)
x% = x% + 1
Next l%
'----- Draw top bevel
x% = 0
For l% = 0 To bevelwidth
f.Line (pwidth - x%, l% + ptop)-(pwidth - x%, pheight + 1)
x% = x% + 1
Next l%
End Sub
" Drive_ready, used to see if specified disk drive is ready."
'+-------------------------------------------------|PT AutoDoc|-------+
'| |
'|Name: drive_ready Revision: 1.00 Date: 12-29-1994|
'| |
'|Author: Chris Haynes |
'| |
'|Operation: Checks to see if specified drive is ready. |
'| |
'|Parameters Passed: |
'| diskdrive$: Drive letter to test for. |
'| |
'| Return value: Returns true if the drive is ready and false if it is|
'| |
'| Copyright (C) 1994, All Rights Reserved |
'+--------------------------------------------------------------------+
'
Function drive_ready (diskdrive$)
On Error Resume Next
x$ = Dir(diskdrive$ + ":\*.*", 16)
If Err Then drive_ready = False Else drive_ready = True
End Function