Mousepos? 2 is a visual aid helper for those who have to make presentations. This program is so good it simply blows all the others out of the water. However, I have just had to reevaluate my opinion of all those programs and chuck them into the 'acceptable' bin, because, no matter how good some of them were, none of the stands up to Mousepos? 2 in any way. MouseConnectWaitCursor.I've seen and tried all kind of presentation aid software over time, and I've seen both good and bad. Here's a program that subclasses the MouseConnect class and displays an hourglass cursor during the OnPaint processing. One program in this chapter that might spend a considerable amount of time in its OnPaint method is MouseConnect. Fortunately, this problem affects the mouse cursor only when the mouse is positioned over the errant application. If a program calls Hide more than Show, the mouse cursor is made invisible. If a program calls Show more than Hide, it risks leaving a visible mouse cursor on the screen when a mouse isn't installed. What this means is that an application must balance its calls to Cursor.Show and Cursor.Hide. The mouse cursor is visible if the show-count is greater than 0 and hidden otherwise. The Cursor.Show method increments the show-count the Cursor.Hide method decrements it. If a mouse is not installed, the show-count is initially 0. If a mouse is installed, this show-count variable is initially set to 1. You can think of the mouse cursor as having a show-count variable associated with it. To display a mouse cursor regardless of whether or not a mouse is installed, a program can make use of the following two static methods of the Cursor class:Ĭursor Static Methods void Show() void Hide() However, if the user is running Windows without a mouse installed, the hourglass cursor won't be visible. The program can then carry out the lengthy job it needs to do and afterward restore the arrow cursor by calling A program can display the hourglass cursor using the statement But let me show you first a couple cases in which the Cursor.Current property does work.Īs you know, programs that must perform lengthy jobs generally display a cursor shaped like an hourglass, which is the predefined Cursors.WaitCursor object. However, you might find that this approach doesn't always work. You can also set the current mouse cursor by using the Cursor.Current property. The Position and Clip properties are both in screen coordinates, so you probably need to use PointToClient after obtaining the properties or PointToScreen before setting the properties. You can set this property only if the mouse is captured. (The Beziers program in Chapter 13 uses Cursor.Position to set the cursor position.) The Cursor.Clip property limits the movement of the mouse cursor to a specified rectangle. The Cursor.Position property is writable as well, although it's not common for applications to set the position of the mouse cursor. You can't use it to set the mouse cursor position. You'll recall that the Control class includes a static property named MousePosition, but that property is read-only. Windows.Forms namespace-consists solely of 28 static read-only properties that return predefined objects of type Cursor:Įven if you obtain Cursor objects only from the Cursors class, there are still three static properties of the Cursor class that are useful: (Notice the plural.) The Cursors class-also defined in the System. In most cases, the easiest way to get a cursor object is by using the Cursors class. I'll describe the Cursor class in more detail in Chapter 11. The mouse cursor is an object of type Cursor, a class defined in the System. In a text-entry field, the cursor becomes a vertical I-beam. Often it's an arrow, but if you pass it over a sizing border of a form, it changes into a double-headed arrow. As you know, the cursor can change appearance depending on its location. The mouse cursor is the little bitmap image you see on the screen that indicates the location of the mouse.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |