Recently I've read few questions about adding shadow to views and decided to make a class for it.
It "just" adds a panel with the required color under the defined view.
Simple methods:
- Initialize(Parent As Panel, V As View, color As Int, angle As Float, margin As Float, radius As Float)
- SetColor(color As Int, radius As Float)
- SetMargin(margin As Float)
- SetAngle(angle As Float)
There is a demo attached.
Comments are welcome !
Edit: Version 2 is here with two more features:
1. When using a bitmap with transparent parts, set -1 as radius (in initialization and in SetColor).
2. Shadow can be rotated but you should rotate it in the same angle you rotate the view...
- SetRotation( Angle As Float)
Edit: Ver. 2.1 - SetRotation rotates the view and the shadow in the defined angle, in degrees
Edit: Ver 2.2 - per Cableguy's request I added option for a gradient shadow. I had to rebuild most of the class, it has an initialization which is just for init, then you have to call start1 or start2. start1 is one color, start2 is gradient. I leave both on for download, if you don't need the gradient - use 2.1
It "just" adds a panel with the required color under the defined view.
Simple methods:
- Initialize(Parent As Panel, V As View, color As Int, angle As Float, margin As Float, radius As Float)
- SetColor(color As Int, radius As Float)
- SetMargin(margin As Float)
- SetAngle(angle As Float)
There is a demo attached.
Comments are welcome !
Edit: Version 2 is here with two more features:
1. When using a bitmap with transparent parts, set -1 as radius (in initialization and in SetColor).
2. Shadow can be rotated but you should rotate it in the same angle you rotate the view...
- SetRotation( Angle As Float)
Edit: Ver. 2.1 - SetRotation rotates the view and the shadow in the defined angle, in degrees
Edit: Ver 2.2 - per Cableguy's request I added option for a gradient shadow. I had to rebuild most of the class, it has an initialization which is just for init, then you have to call start1 or start2. start1 is one color, start2 is gradient. I leave both on for download, if you don't need the gradient - use 2.1
Attachments
Last edited: