Click here to Skip to main content
13,046,679 members (58,998 online)
Rate this:
Please Sign up or sign in to vote.
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 21-Dec-11 0:12am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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]

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 21 Dec 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100