
52
LESSON 4 Handling EvEnts
EVENT MEANING
MouseEnter
The mouse has entered the control.
MouseHover
The mouse has hovered over the control.
MouseLeave
The mouse has left the control.
MouseMove
The mouse has moved while over the control.
MouseUp
The user released a mouse button over the control.
Move
The control has moved.
Paint
The control needs to be redrawn. (This is useful for drawing graphics.)
Resize
The control has resized.
Scroll
The slider on a TrackBar or scrollbar was moved by the user.
SelectedIndexChanged
A ComboBox’s or ListBox’s selection has changed.
TextChanged
The control’s Text property has changed. (This is particularly useful
for
TextBoxes.)
Tick
A Timer control’s Interval has elapsed.
ValueChanged
The value of a TrackBar or scrollbar has changed (whether by the
user or by code).
TRY IT
In this Try It, you use event handlers to display color samples as the user adjusts red, green, and
blue scrollbars.
Figure 4-4 shows the finished program in action. When
you change a scrollbar’s value, the label to the right shows
the new value and the large label on the far right shows a
sample of the color with the selected red, green, and blue
color components.
You can download the code and resources for this Try It from the book’s web
page at
www.wrox.com or www.CSharpHelper.com/24hour.html. You can find
them in the Lesson04 folder in the download.
FIGURE 44
TABLE 41
(continued)
596906c04.indd 52 4/7/10 ...