开发者

How do I do a iPhone button-like fill

I'd like to spruce up some of the user controls I use and thought some attractive fills should do the job (part of it perhaps). Like the fill in the background of iPhone buttons or the Offi开发者_StackOverflow中文版ce 2007 ribbon bar (perhaps you know a few more).

Edit: To clear things up, I don't need a simple gradient fill - there is a Windows API call for that. I am more interested in how the entire effect is achieved. Here is a link to an article that shows how to do it in PhotoShop, but I want to accomplish that in code.

Specifically, the glossy gradient at the top ends in a curve roughly in the middle of the button. I half expect that this will need to be rendered separately and blended somehow.

Any ideas?


The "glass" effect is made simply by creating a white ellipse around 4x larger than tall, placing it over the image to be "glassed" so that the bottom arc is centered on the image then alpha blending. I believe this sample delphi code will be some help in performing the final portion.


You're talking about gradient fills. You can get some code samples here to start with - search that page for "gradient" to find the relevant sections.


You could try http://www.tmssoftware.com/site/advsmoothbutton.asp. As far as I know this control is included in a free Smooth Controls pack with D2009. For other Delphi versions you could buy the TAdvSmoothButton control itself or as part of a control pack.


The easiest way to do this is probably by assembling images based on the button size. Create a base image, and resize some layers over top of it, rather than trying to procedurally generating a complex gradient.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜