|
-
Feb 21st, 2000, 01:54 PM
#1
Thread Starter
Hyperactive Member
Any way that i have an IMAGE, and i want the picture to change when the mouse moves on it (have it) then i need it to change back when you don't have the mouse on the image, any way to use get focus or something???
any way thanks
-
Feb 21st, 2000, 02:28 PM
#2
Frenzied Member
Here is a down-and-dirty way to do it, but it is surely not the best.
Drop an ImageList control on your form (to include it in your tools, right-click on the toolbox, choose "Components...", and check the box next to "Microsoft Windows Common Controls 6.0" and click Ok.
Then set up your two pictures in the ImageList control that you want to be available for your Image control.
Put the following code in your form's code window (assuming your image control is named Image1 and your image list is named ImageList1):
Code:
Option Explicit
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Picture = ImageList1.ListImages(1).Picture
End Sub
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Picture = ImageList1.ListImages(2).Picture
End Sub
Now, when the mouse moves over your image, the picture changes, and when it moves over the form, it changes back. The problem is that if the user moves too quickly from your image to another control, the picture doesn't change. You could add code in the other control's MouseMove events as well to stop this, but there is probably a better way.
Hope this helped a little.
~seaweed
Edited by seaweed on 02-23-2000 at 01:33 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|