Option ExplicitContoh penggunaan fungsi membuat efek bayangan pada objek:
Public Function Shadow(frm As Form, ctl As Control, Optional shWidth = 3, Optional Color = vbGrayed)
Dim oldWidth As Integer
Dim oldScale As Integer
With frm
oldWidth = .DrawWidth
oldScale = .ScaleMode
.ScaleMode = 3
.DrawWidth = 1
frm.Line (ctl.Left + shWidth, ctl.Top + shWidth)-Step(ctl.Width - 1, ctl.Height - 1), Color, BF
.DrawWidth = oldWidth
.ScaleMode = oldScale
End With
End Function
Private Sub Command1_Click()
Shadow Me, Command1, 2, vbBlack
End Sub
Anda dapat menggunakannya pada objek secara bulk dengan menggunakan for...each.