Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# GDI+
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 1:12am

1 solution

Rate this: bad
good
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]
  Permalink  
v2

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

  Print Answers RSS
0 BillWoodruff 300
1 Mathew Soji 274
2 Afzaal Ahmad Zeeshan 268
3 DamithSL 225
4 Sergey Alexandrovich Kryukov 205
0 OriginalGriff 6,249
1 Sergey Alexandrovich Kryukov 5,853
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 3,865


Advertise | Privacy | Mobile
Web03 | 2.8.1411019.1 | Last Updated 21 Dec 2011
Copyright © CodeProject, 1999-2014
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