by Joseph Varghese (2 Submissions)
Category: Coding Standards
Compatability: Visual Basic 5.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (5 Votes)
i saw many people creating shadow by adding a label control it dosent matter if you have min no of controls but when you have large no of controls
So here is the code to create shadow without using any other controls
Just paste this code ***Have Fun***
Assumes
Create shadow just using code
Public Sub SHADOW(Frm As Form, Ctrl As Control)
Const SC = vbBlack 'you can define your own color
Const SW = 3
Dim IOLDWIDTH As Integer
Dim IOLDSCALE As Integer
IOLDWIDTH = Frm.DrawWidth
IOLDSCALE = Frm.ScaleMode
Frm.ScaleMode = 3
Frm.DrawWidth = 1
Frm.Line (Ctrl.Left + SW, Ctrl.Top + SW)-Step(Ctrl.Width - 1, Ctrl.Height - 1), SC, BF
Frm.DrawWidth = IOLDWIDTH
Frm.ScaleMode = IOLDSCALE
End Sub
Private Sub Form_paint()
SHADOW Me, Command1
End Sub