|
-
May 30th, 2001, 04:51 PM
#1
Thread Starter
Hyperactive Member
rollover image...please helppp!!!!
hello,
what is the code to make a rollover image effect? I have a picture and when the mouse moves over it, I want the image to change into a different image. I asked this before, but the code did not make sense.
Visual Basic 6, HTML, JavaScript, learning C++
-
May 30th, 2001, 04:59 PM
#2
-
May 30th, 2001, 05:00 PM
#3
A simple way to do it:
have 3 ImageControls
1 main
2 that are not visible
on mousemove
Image1.picture = Image2.picture
then to set it back....image1.picture = image3.picture
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
May 30th, 2001, 05:04 PM
#4
Need-a-life Member
This is the best way I know to create a "rollover image" effect. The "how" you load the new image is up to you, there are several different way to do it: Loadpicture, a picture array, an ImageList, whatever. But the essence of the effect is shown in this code:
Code:
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
With Picture1
If (X < 0) Or (Y < 0) Or (X > .Width) Or (Y > .Height) Then
ReleaseCapture
.Picture = RollOver(0).Picture
Else
SetCapture .hwnd
.Picture = RollOver(1).Picture
End If
End With
End Sub
The PictureBox RollOver is an array, but you can use whateve method you like to load one or other image.
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
May 30th, 2001, 05:12 PM
#5
good Idea ReleaseCapture / SetCapture....
then you wont have to program the form mousemove to set the image back
much cleaner Display
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Feb 5th, 2002, 06:47 AM
#6
Member
mouse over effect
I would Like my images to swap when the cursor is moved over one image.
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
|