Hello!
How can i use the mouse OFF event in visual basic?
Hello!
How can i use the mouse OFF event in visual basic?
For your "mouse off event" the following code tells the object to move to an x position of 100 on roll out (roll out is the correct mouse off) obviously you will have to change the properties to make your button do what you want it to do.
Personally I prefer attaching the script to the timeline as opposed to the object if you want to do it this way use:Code://attach this code directly onto your button on(rollOut){ this._x = 100; }
This is more long winded but if you are using alot of code it makes it easier to locate it as it will all be in the timeline. Note: If using this method don't forget to give your button a instance name, you can double check this by targeting your button using the target option in the actions window.Code://attach this code to the timeline on a locked layer named actions this.yourbutton_btn.onRollOut = function(){ this._x = 100; }
Unless VB.Net has a mouse off event (which it might, I don't know), The answer is "there isn't one". I know VB6 doesn't have one. The only way to find out if the mouse has gone off the form is to use an api call. You need to use the getcursorpos api, and pass it the POINTAPI Type. This will effectively give you the current X Y coordinates of the mouse.
Then, you get the current X, Y coordinates of your form (maybe using getwindowrect, with type RECT), and then compare to see if the mouse falls within those boundaries. If it is within those boundaries, the mouse is on the form. If it's not, then it isn't. So you could use a timer control, and check every millisecond where the mouse is. As long as it's on your form, set a variable to true. When it leaves your form, set it false, and execute some kind of "off form" code. Another option, is to set a global hook on the mouse, and whenever you recieve a WM_MOUSEMOVE, check it's coordinates, compare, and execute.
Bookmarks