In this exercise, we will use track bars to change the
color of a static control.
There are various types of objects you can use to
preview a color. The static control is convenient because it provides a
ready made rectangle although you still have to configure it because it is
not natively equip to handle the change of colors. To do this, you can
consider it simply as a platform with a client area. When painting this
control, you mostly use the properties of the CWnd class. For this reason,
you could as well use a list box, a tree view, or a list view, etc.
To allow the user to set the variances of a color, you
can use sliders, scroll bars, or spin buttons, etc. In this exercise, we
will use the sliders simply because we decide to use them. They don't
necessarily provide more or less functionality than scroll bars or spin
Giving live and necessary feedback to the user is one
of the greatest assets of a friendly application. On this application, we
will use static text controls to show the red, green, and blue values of a