Make your own free website on Tripod.com

Make 3D Controls

'Add a module to your project (In the menu choose Project -> Add Module, Then click Open)
'Add 1 Command Button and 1 Text Box to your form.
'This example will make 3D TexBox. You can the the same with other controls.
'Insert this code to the module :

Public Sub ThreeDControl(Ctrl As Control, nBevel%, nSpace%, bInset%)
PixX% = Screen.TwipsPerPixelX
PixY% = Screen.TwipsPerPixelY
CTop% = Ctrl.Top - PixX%
CLft% = Ctrl.Left - PixY%
CRgt% = Ctrl.Left + Ctrl.Width
CBtm% = Ctrl.Top + Ctrl.Height
If bInset% Then
For i% = nSpace% To (nBevel% + nSpace% - 1)
AddX% = i% * PixX%
AddY% = i% * PixY%
Ctrl.Parent.Line (CLft% - AddX%, CTop% - AddY%)-(CRgt% + _
AddX%, CTop% - AddY%), &H808080
Ctrl.Parent.Line (CLft% - AddX%, CTop% - AddY%)-(CLft% - _
AddX%, CBtm% + AddY%), &H808080
Ctrl.Parent.Line (CLft% - AddX%, CBtm% + AddY%)-(CRgt% + _
AddX% + PixX%, CBtm% + AddY%), &HFFFFFF
Ctrl.Parent.Line (CRgt% + AddX%, CTop% - AddY%)-(CRgt% + _
AddX%, CBtm% + AddY%), &HFFFFFF
Next
Else
For i% = nSpace% To (nBevel% + nSpace% - 1)
AddX% = i% * PixX%
AddY% = i% * PixY%
Ctrl.Parent.Line (CRgt% + AddX%, CBtm% + AddY%)-(CRgt% + AddX%, _
CTop% - AddY%), &H808080
Ctrl.Parent.Line (CRgt% + AddX%, CBtm% + AddY%)-(CLft% - AddX%, _
CBtm% + AddY%), &H808080
Ctrl.Parent.Line (CRgt% + AddX%, CTop% - AddY%)-(CLft% - AddX% - _
PixX%, CTop% - AddY%), &HFFFFFF
Ctrl.Parent.Line (CLft% - AddX%, CBtm% + AddY%)-(CLft% - AddX%, _
CTop% - AddY%), &HFFFFFF
Next
End If
End Sub

'Insert this code to your form:

Private Sub Command1_Click()
'Replace 'Text1' with the name of the control you want to make 3D
ThreeDControl Text1, 1, 0, True
End Sub

Go Back