by Flavio Gonz¨lez V¨zquez (2 Submissions)
Category: Graphics
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Mon 9th June 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
This code drops a shadow under controls like Windows XP does. You can drop the shadow to all controls in a form or drop the shadow to one or
'* *
'* SHADOW CONTROLS FORM *
'* © by Flavio González Vázquez *
'* *
'* First, configure the following *
'* parameters *
'* *
Const FirstLines = 15 'Top shadow roundless *
Const EndLines = 15 'Bottom shadow roundless *
Const Measure = 15 'Form measure (p.e. twips) *
Const Desp = 60 'Shadow desp *
Const Band = 50 'Shadow brightness *
'* *
'* *
'* To shadow all controls in a form, *
'* call to ShadowControls() method. *
'* *
'* To shadow a control in a form *
'* call DropShadow() method *
'* *
'* Visit me on the following websites: *
'* *
'* www.flavio.6x.to *
'* www.flavionet.6x.to *
'* *
'* *
'* *
Sub DropShadow(Control As Object, Formu As Form)
Dim n
For n = 0 To 120 Step Measure
DrawRect Formu, Control.Left + Desp + n / 2, Control.Top + Desp + n / 2, Control.Width - n, Control.Height - n, RGB(256 - (n + Band), 256 - (n + Band), 256 - (n + Band))
Next
End Sub
Sub DrawRect(Control As Form, l, t, w, h, color)
Dim x, xx
For x = t To t + h Step Measure
xx = x - t
Select Case xx
Case Is < FirstLines
Control.Line (l + (FirstLines - xx), xx + t)-(l + w + xx - FirstLines, xx + t), color
Case Is > h - EndLines
Control.Line (l - h + EndLines + xx, xx + t)-(l + w - (EndLines + xx - h), xx + t), color
Case Else
Control.Line (l, xx + t)-(l + w, xx + t), color
End Select
Next
End Sub
Sub ShadowControls(Formu As Form)
Dim n
For n = 0 To Formu.Controls.Count - 1
DropShadow Formu.Controls(n), Formu
Next
End Sub
No comments have been posted about This code drops a shadow under controls like Windows XP does. You can drop the shadow to all contro. Why not be the first to post a comment about This code drops a shadow under controls like Windows XP does. You can drop the shadow to all contro.