Nice Buttons
As I wrote in my first post, I'm currently developing some kind of "DJ software" in my spare time. The first versions grew by adding feature by feature over several years, the new version is a complete rewrite from bottom up. This whole project will take a lot of time, with lots of coding to be done before there's actually something usable.
While I'm implementing the framework, I also work on "visible" stuff to keep my motivation up (this is a private project, and I don't expect making [much] money from it). Something "visible" is e.g. the audio player control. I don't use the Windows Media Player control directly, instead I'm using the (non-GUI) WMP object hidden behind an abstraction layer, which is accessed by a user control showing the GUI..
A GUI for a player has to be cool (but no "unusable 1337 skinz", please), including nice looking buttons for "start/stop/pause/etc.". So here's what my buttons look like:
Nice, huh? So how much effort went into those buttons? Very little. If you're not looking for a "100% perfect" solution, you can get pretty good results just playing around with the properties "BackColor", "BackgroundImage" and "Image" of a WinForms button.
- Step 1: Decide how high the button will be; for this example, let's choose a height of 32 pixels. The width doesn't play a role as the image can be repeated horizontally without looking bad. Fire up your favorite paint program, create a 32x32 image and perform a vertical gradient fill from white (#FFFFFF) to gray (#C0C0C0):
- Step 2: Let's try it in VS.Net:
- Put a button on a form, 32 pixels high.
- Set the "BackColor" to white
- Set the "BackgroundImage" property
- Step 3: Design the button image:
and save it as a GIF file with transparent background: - Step 4: In VS.Net, clear the button text and set the "Image" property:
- That's it!
Remarks:
- Leave an empty pixel column/row at the right/bottom border of your button image, otherwise the image will not appear centered on the button.
- Of the background image, the outer 2 pixel rows/columns will not be visible, they are hidden behind the border of the button.