473,322 Members | 1,473 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Buttons with run-time adjustable images

6
I am creating an Windows Form application in C# that at a certain point opens an all screen form formed by a "grid" of buttons.
I would like some of these buttons to visualize (besides a title) an image on them, that may be modified (e.g. become semi-transparent) at run-time: at the moment an event is fired (in particular clicking on the same button).
How should I do? Should I use the BackgroundImage or Image of the Button class? Should I put a PictureBox on the button? Or should I use to create my buttons another class than Button, maybe more complex and suitable for my purpose?
I already tried something, but with not much success!
Sorry for my English, thanx for your help!
Davide
Mar 19 '07 #1
1 904
SammyB
807 Expert 512MB
Davide, Your English is good. I would use an ImageList "control" and place both images in it. Then you can set the Button's ImageList property to the ImageList and set the ImageIndex to the index. Then your click event just changes the index:
Expand|Select|Wrap|Line Numbers
  1. private void button1_Click(object sender, EventArgs e)
  2. {
  3.     if (button1.ImageIndex == 0)
  4.         button1.ImageIndex = 1;
  5.     else
  6.         button1.ImageIndex = 0;
  7. }
Mar 19 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Bob Lehmann | last post by:
Hi, I pretty sure I've seen this problem addressed before, but I can't find any references. The short story is that I have I have multiple submit buttons on a page, each providing different...
0
by: Evgeniy | last post by:
I develop an Addin for MS Word. There are a few buttons on a toolbar. When you are working with the single document everything is OK. If I run another WINWORD process the buttons work correctly in...
5
by: Colleyville Alan | last post by:
I have a sub that can do two different tasks based on the value of one variable. So I'd like to have two different buttons on the same form run this, but each one setting a flag so that the...
4
by: Mat N | last post by:
I have some check boxes on my form named as follows: chkTriggerYTD1 chkTriggerLAST1 chkTriggerYTD2 chkTrigerrLAST2 and some buttons: cmdYTD1
1
by: melanieab | last post by:
Hi, I'm not sure what happened here, but I had a whole set of tabpages with home-made buttons on them. A shortened version of the class I wrote them in is here: using System; using...
1
by: Jerry | last post by:
We have a 10-question quiz for kids, each question being a yes or no answer using radio selections. I'd like to keep a current total of yes's and no's at the bottom of the quiz (if the user selects...
2
by: Wayne | last post by:
I've been having a click around Access 2007 this afternoon and have discovered some things that range from annoying to alarming. My Access 2003 menu bars, which I, like many others, use...
4
by: Blasting Cap | last post by:
I have a page that has a number of radio buttons that will be displayed to different access levels of a user who logs in to my website. For instance, if there are a dozen buttons, user1 will see...
1
by: Bob Alston | last post by:
Trying to install some software on Access 2007. The software works just fine on earlier versions of Access. I have been told that it works on Access 2007 but I have not seen that personally. ...
3
by: Shisou | last post by:
Hey Guys, I'm currently writing a java applet for my class and I've run into a quirky little problem. I assure you answering this won't be considered cheating in anyway since it's just a bug and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.