I’m building a windows form in C# with VS2008.I have about 32 buttons, I’ve placed an image over the default buttons, but I want to have a Hover/Up/Down effect for each of these buttons, and I can’t seem to find this information anywhere.
Perhaps I’m searching for the wrong terms, any direction is appreciated.
Inherit from the System.Windows.Forms.Button class, and override the following methods:
The code would look something like this:
Now since you have multiple buttons, you could of course turn the resource acquisitions into properties.
And use those in the overridden, virtual methods. This is probably your best approach. I would avoid the answer below (no offense Phoexo) as it is a very unusual and messy solution.
Once you write and compile the new button, you can do a simple find and replace to change the existing button’s types. You will have to do a little cleanup and set the three properties for each button to their corresponding images, and cleanup some designer code, but this will make your life easier in the long run if you have to add more buttons.