Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Chapter 3: Windows Resources Visual C++ and MFC Fundamentals


3.7.2 Creating and Using Cursors..................................................................


Microsoft Windows installs a wide array of cursors for various occasions. Like all other
resources, a cursor is identified by a constant integer that can be communicated to other
files that need it.

Essentially, a cursor uses only two colors, black and white. This is because a cursor is
only used as an indicator of the presence or position of the mouse pointer on the screen.
Based on this (limitation), you ought to be creative. The minimum you can give a cursor
is a shape. This can be a square, a rectangle, a circle, an ellipse, a triangle, or any shape
of your choice. You can make the cursor fully black by painting it with that color. If you
decide to make the cursor completely white, make sure you draw borders.

Between the black and white colors, two gray degrees are provided to you. In reality
these two colors are used to give transparency to the cursor so the background can be
seen when the mouse passes over a section of the document.

After designing a cursor, you should define its hot spot. A cursor's hot spot is the point
that would be used to touch the specific point that the mouse must touch to perform the
action expected on the mouse. The hot spot must be an area, namely a spot, on the cursor
but it could be anywhere on that cursor. You should specify the hot spot in the most
intuitive section of the cursor. In other words, the user should easily identify it since it is
not otherwise visible.
Free download pdf