Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Drop a Windows XP style shadow
Author:
Flavio González Vázquez
E-mail:
Click to e-mail author
Website:
http://www.flavionet.tk
Submitted:
8/28/2003
Version:
VB5
Compatibility:
VB5, VB6
Category:
Graphics
Views:
15453
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 more controls.
Declarations:
'none
Code:
************************************************* '* * '* 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
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement