Click here to Skip to main content
15,887,361 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone, I want to make a paint program like MS Paint but I have a problem .I want to have a function handle a Mouse up event that return checked status of previous Button Click.
For example, Fill-Color Button is checked, then I click Pick-color Button, pick-color button is checked now. After picking (mouse up) pick-color button is unchecked and Fill-color Button is checked again ??
Thank you!
Posted

1 solution

It's difficult to give advice to a question as vague as that, but I would do it by having a state variable, and stacking the current state. When you switch mode, stack the existing state and enter a new one. When you exit from the state, check the stack - if it is not empty, then pull off the top item, and set that as your current state.

The .NET framework does include a Stack class, but it is non-generic and you might want to encapsulate it in a generic or specific class first.

Sorry not to give a precise answer, but we can't see your code - we have to give general advice!

[edit]Oops! There is also a Generic version of the Stack class in System.Collections.Generic - OriginalGriff[/edit]
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900