Click here to Skip to main content
13,094,732 members (96,559 online)
Rate this:
Please Sign up or sign in to vote.
how do i change the color of the button by adding a different image from image list


'getting error value of type can not be converted in system.drawing.image

i need the button color(image) should change after a certain condition is met
Posted 17-Apr-13 3:37am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I wouldn't do that at all if I wanted that functionality. I would use a toolstrip instead of a button. You can float them anywhere on your form, and make them transparent. You can set up a number of buttons, and hide the button with the image you want to remove, and show the button with the one you want to show. This makes adding functionality for the different button states easier, as they each have their own event handler. I did this in my CodeProject article:

SharpZipLib or DotNetZip... Which should you use?

Why not download the project and have a look? I think you'll be happier doing it this way then using a standard button. I never use them anymore myself.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170813.1 | Last Updated 17 Apr 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100