Hello!
I'm reading in a book and here they says.
"Now it is time to begin thinking about which events the control should
provide. Because the control is
derived from userControl class, it has inherited a lot of functionality that
you don't need to worry about.
There are, however, a number of events that you don't want to hand to the
user in the standard way.
Examples of this include the KeyDown, KeyPress and KeyUp events. The reason
you need to change
these events is that users will expect them to be sent when they press a key
in the textbox.
As they are now, the events are only sent when the control itself has focus
and the user presses a key.
To change this behavior, you must handle the events sent by the text box,
and pass them on to the user.
Add the KeDown, KeyUp, and KeyPress events for the text box and enter the
following code."
Now to my question what do they mean with saying this in the text above
"There are, however, a number of events that you don't want to hand to the
user in the standard way.
Examples of this include the KeyDown, KeyPress and KeyUp events. The reason
you need to change
these events is that users will expect them to be sent when they press a key
in the textbox.
As they are now, the events are only sent when the control itself has focus
and the user presses a key.
To change this behavior, you must handle the events sent by the text box,
and pass them on to the user. "
Can somebody explain that
private void txtLabelText_KeyDown(object sender, KeyEventArgs e)
{
OnKeyDown(e);
}
private void txtLabelText_KeyUp(object sender, KeyEventArgs e)
{
OnKeyUp(e);
}
private void txtLabelText_KeyPress(object sender, KeyPressEventArgs e)
{
OnKeyPress(e);
}
//Tony
|