Click to See Complete Forum and Search --> : How can i ?
Tarendor
September 14th, 2001, 08:15 PM
How can i make it so that when i click the command1 button it changes the cursor to a different cursor and then when i click the mouse button after it has been changed have it change back to its normal state befor i clicked the command button??
Does this make sence?
(this is on a form and not in html)
tobeyu
September 16th, 2001, 03:06 PM
Well, you don't necessarily have to use the API to do this. All you have to do is use the MousePointer property.
The biggest question is do you want the new cursor to be seen no matter where the mouse is (i.e. outside of your form, not just over the command button, etc.)? If you use the MousePointer property of the command button, the new cursor will only be visible when the mouse is over the command button. If you change the MousePointer property of the of the form, the new cursor will only be visible when the mouse if over the form. One note on this, depending on the control, the new cursor will not be seen.
Basically, in short, if you want the new cursor to be available no matter where the mouse is, use the MousePointer of the Screen object (Screen.MousePointer = NewCursor). Then as far as changing it back just put Screen.MousePointer = vbDefault in whatever event you want to change it back.
If you are not familiar with the MousePointer property, if you do not use or want one of the standard cursors, you can use a custom one by setting the MousePointer property to vbCustom (99) and set the MouseIcon property to the custom cursor.
So, in short, that is all you have to do as well as a little insight to some mouse properties.
Hope that helps,
Tobey
Tarendor
September 17th, 2001, 09:16 AM
Can you show me exactly how to make this happen
i want it to show the new mouse inside and outside the form when i hit the command button but as soon as i send a mouse event (use the buttons on the mouse ) i want it to revert to its previous mouse cursor,
tobeyu
September 17th, 2001, 10:43 AM
Assuming the command button's name is Command1:
private Sub Command1_Click()
Dim strPath as string
strPath = ' this needs to be a fully qualified path i.e. "C:\Program Files\..." and it has to be an icon file (*.ico)
Screen.MouseIcon = LoadPicture(strPath)
Screen.MousePointer = vbCustom
End Sub
Now, depending on what fires your mouse event, that procedure would change it back
private Sub YourMouseEvent()
Screen.MousePointer = vbDefault
End Sub
You don't have to use the MouseIcon property above if you are going to be using one of the standard cursors (Resizing cursor, hourglass, etc.). To use those, simpy set the MousePointer property to one of the named constants (vbDefault, vbHourglass, vbSizeNS, etc.).
Clear as mud?
Check out http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vb98/html/vbpromousepointer.asp for all of the standard mouse pointer constants.
Hope that helps,
Tobey
Tarendor
September 17th, 2001, 12:20 PM
i must be totally brain dead today because i cant get this to work :(
i want it to change the curso so that when i move the mouse out of the form it is the cursor i changed it to and all i want to do is click on the desktop one time and then it returns to what it was b4
DeafBug
September 28th, 2001, 12:42 PM
Instead of using the word Screen use Me. Like this Me.MousePointer.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.