Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Change the default button image - visual studio 2010

Posted on 2012-09-11
2
Medium Priority
?
1,812 Views
Last Modified: 2012-09-11
I am working on a project that has multiple forms with probably close to 100 total buttons.  Right now, those buttons are actually pictureboxes that I create mouseenter, mouseleave, and click events to act like buttons.

Occasionally, I want to change the appearance of the program, but I then have to individually change each picturebox image to change the appearance of the button.  That means changing the mouseenter and mouseleave images for every single button.

Is there anyway that I can change the default button image and it's mouseover image so that I can simply change the one button and it will apply to all buttons in my program?  Something that would allow me to also enter different text onto each button, but maintain the same image.
0
Comment
Question by:lostinthegame
2 Comments
 
LVL 12

Accepted Solution

by:
Jared_S earned 2000 total points
ID: 38388449
I think you'll have to create a custom/extended control and use that in place of the standard button/picture box.

http://msdn.microsoft.com/en-us/library/ms171725.aspx
0
 

Author Closing Comment

by:lostinthegame
ID: 38388774
Awesome!  Got it working.  Here's what I did:

1) created a new Windows Form Control Project
2) changed the designer.vb to inherit button instead of control
3) fixed the errors that popped up
4) imported my mouseover and mouseup images
5) set my mouseup image as the control background image
6) added the mouseenter and mouseleave events to change the image
7) built the project and then closed it
8) opened my windows form project, right clicked the toolbar, and picked "choose items"
9) opened the .dll from my control project's bin folder
10) dragged the new button onto my windows form

I tested it out, and all I have to do now is change the image in my control projects resource file and then rebuild it to change all of the buttons in my windows form project.

Wish I knew this before.  I've probably spent 50 hours redesigning each button multiple times...

Thanks for the help.
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Make the most of your online learning experience.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Screencast - Getting to Know the Pipeline

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question