This should be fairly easy to do... I've never done it before, but I have an idea so lets dive in and figure it out together :)
I'll start with a rough outline... you've got a form with controls on it. I believe every single control has an event for "Click". So that means you can do
something when a control is clicked.
We also know that we want a help mode state that we can toggle on or off that we can preserve for that particular class.
So we can design a state...
- enum FormState
-
{
-
Normal,
-
Help
-
}
We can then create a class member of this type and default it to the normal state. Now, whenever we click a control, in the event handler we can check the state and take an action based on what that state is.
If the state is help, we can display help for that control. If it's normal, we can take whatever action we normally would.
The event handlers might look like this...
For the Help button...
- private void HelpButton_Click(object sender, EventArgs e)
-
{
-
if (e is Button)
-
{
-
if (m_formState == FormState.Help)
-
m_formState = FormState.Normal;
-
else
-
m_formState = FormState.Help;
-
}
-
}
(Note, you may also want to change the form's cursor)
Then for a text box's click event you may want to have the following in the event handler...
- if (m_formState == FormState.Help)
-
DisplayHelp();
-
else
-
DoWhateverWeDoOnTextBoxClick();
-
Hopefully that helps and gets you started.