Today, a good user interface must have a nice look, too. As the iPhone shows, using an application must be some kind of fun.

In order to create such GUIs, the controls provided by the .NET Compact Framework are lacking a lot of functionality. However, the MSDN gives us some hints: in this article, they show us how to create a button filled with a gradient background.

When using gradients from RGB(238, 238, 238) to RGB(128, 128, 128) one can reach pretty nice results. Furthermore, it is possible to only fill the upper 10 pixels of a black button with a gradient from black to white using the StartOffSet and EndOffSet property. This way, you get buttons similar to the ones currently used by HTC for their TouchFlo user interface.

Well, what about adding rounded corners to the gradient filled buttons? This is far more easy that you might think. I have added a code example on my community Gradient Button Code.
Simply copy the code located in the linked topic. It must be inserted at the end of the function DrawImage from the original example out of the MSDN.
The idea is to draw the border manually instead of just adding a rectangle around the button. At each corner, we “dash” the border by one pixel to achieve the look of a rounded corner. That’s all the trick!

RichFaces: rich:modalPanel with rich:componentControl doesn’t show data
“Shiny Table” Effect with Gimp

Are you interested in reading more from CodingClues?
Then subscribe to new postings via RSS or via E-Mail.

close Reblog this comment
blog comments powered by Disqus