Gradient buttons

derez

Expert
Licensed User
Longtime User
I found that designing gradient buttons with B4PPC is much easier than with .Net ...
Here are few subs that create a new button or convert an existing button to a gradient button, with few examples for design.

I put Filippo's button as another example.

I believe anybody can modify or create his design for the button he likes most.

with reference to an imagebutton, the additional parameters are:
Startcolor and endcolor, direction - left to right or top to bottom, corners type (actually the design type) and invert-when-pushed effect.

Somehow I kept the movement of the button when pressed down.You can select for shadow but the shadow change sides only with the inversion effect.

The left column in the example show buttons with invert_when_pushed effect, the middle column - without.
The last two buttons demonstrate the fixed arc and variable arc when the width of the button changes.

Button1 is a regular button for comparison.
Button2 is a regular button which was converted by the convert_button sub.

few notes:
1. The last design is based on drawing with a circle, and this function may leave untouched pixels, as you can see in the example, so I don't recomend to use it.
2. You can't change the size of the button after creating it ( you can but the bitmap doesn't change), so if you want to change the size - dispose the button and re-create it with the new size.

edit - updated to have optional shadow.
 

Attachments

  • Gradient_buttons2.sbp
    9.1 KB · Views: 392
  • Gradient.jpg
    Gradient.jpg
    23.5 KB · Views: 369
Last edited:
Top