Jump to content
  • Advertisement
Sign in to follow this  
chrisliando

[.net] How to change button appearance?

This topic is 3882 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I need to change button appearance after it was clicked. Before I click, it is Standard style but after clicked, it became flat. The purpose of this is as an indicator so that users recognize that they has clicked the button. How to do that? Thank you very much..

Share this post


Link to post
Share on other sites
Advertisement
You could just have a variable to hold the state of the button. Then in it's Button_Click() event toggle it and set the button style based on the value.

butState = !butState;

if(butState)
Button.Flatstyle = Flatstyle.Flat;
else
Button.Flatstyle = Flatstyle.Standard;

Share this post


Link to post
Share on other sites
Quote:
Original post by chrisliando
The purpose of this is as an indicator so that users recognize that they has clicked the button.

Just my opinion, but using such a non-standard method is stupid. There's enough crappy software out there without adding more.

Share this post


Link to post
Share on other sites
Why do you think you need to let a user know he's clicked the button. Don't you think he'll figure it out himself? [rolleyes]

Share this post


Link to post
Share on other sites
Once again, this is a request from my Senior. But it is easy compared to displaying active cursor on 2 textBoxes at the same time.

The purpose is to make the application more friendly.

Thank you.

Share this post


Link to post
Share on other sites
Quote:
Original post by Headkaze
You could just have a variable to hold the state of the button. Then in it's Button_Click() event toggle it and set the button style based on the value.

butState = !butState;

if(butState)
Button.Flatstyle = Flatstyle.Flat;
else
Button.Flatstyle = Flatstyle.Standard;


bear in mind that with such an approach, although the button will change style to show it has been clicked, it will still be clickable.

If you are doing this to stop the user from clicking it twice, then you may also want to look at setting the button to disabled. Note that doing this will also change the appearance of the button, so simply doing this and not changing its style may be enough.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!