On 2007-11-20 14:55:02 -0800, Eitan <Ei***@discussions.microsoft.comsaid:
Hello,
I developed a Composite Control with Visual C# (Rocker Button). The button
detects MouseUp events inside the control. However I would like these
MouseUp events to be transferred to the parent form of this control so I can
update the form with the new information.
The messages are trapped inside the control but are not seen by the parent
form.
Any idea how to do that?
While it would be possible to do that, it seems to me that you would
rather use an event to signal the change in the state of the control,
or to react to a specific state.
For example, there's the Control.Click event, which something like a
Button control will use to signal that the button has actually been
successfully depressed and released.
Or you could go the data-centric route. For example, the
Control.TextChanged event will signal when the Text property has
changed.
For a "rocker button", I would think you would expose a single state as
a property (perhaps using an enumeration). If the property is named
RockerState, then you might have a RockerStateChanged event that the
parent form or any other code could subscribe to, for the purpose of
learning when the state of the rocker switch has changed.
Alternatively, you could have events corresponding to each position the
rocker button could have, with each event being raised as the rocker
changes position. I would prefer the previous idea, but this would
work too.
For me, the mouse events are more for use by the control itself to
handle interactions with the user. Higher-level control and signaling
should be implemented with a higher-level paradigm.
Pete