i published some ultra simple buttons a while back that were quite lightweight
these had only text and the text was centrally aligned.

since then i have had requests to include the ability to add an icon and so these buttons have been enhanced to include icons as well as text alignment.

two new properties have been added to the favourites tab to allow this:

1. new property - textalignment

0 - middle (default)
1 - left
- right

2. new property - buttonicon

if set to an image
(bmp, gif, png,jpg) it will display a 24x24 pixel image on the button.
if textalignment = 1 then image is shown on the right otherwise on the left of the button. make
sure your image has a white background as the class will make the white
parts in the image transparent.

3. if property caption is empty and
buttonicon points to an image, then the button drawn with image in the centre.

for usage and setting other properties please refer to the original link for the buttons.

the sample form attached shows the buttons "in action" and also contains the new updated class.

again, please download the original button archive where i have included the updated gdiplusx files to avoid any flashing or "x" boxes appearing, and make sure these buttons point to this new gdiplusx class only.

download the attachment below for the updated button class.


3 Responses to Ultra Simple Buttons with GDI+X + Icons

  • Metin Emre says:

    Thank you. For who will use samples should be change buttonicon folder for don’t get error.

    Sample form is now fixed.

  • Cesar Chalom says:

    Hi Bernard,

    The picture is not appearing, you probably forgot to “publish” it in the weblogger.

    Keep the good work !


    Nope. I did publish it. It is just the weblog software will not duisplay the picture in that place. When I moved it down it showed but not in the original place.

  • Simon Arnold says:

    Yet another fantastic class, I found a really good use for this as a graphical style checkbox, I can change the bitmap and then call the Draw method and the picture changes, fantastic.

    Cool Simon. Glad you found a different use for it. Hope your “other” project is coming along well.

Leave a Reply

Your email address will not be published. Required fields are marked *