-
Hi,
I have an image control in my vb project, and I want it to act as a button. There will be 3 images in the image control at different times.
When the cursor is not near the image, there is image 1.
When the cursor is over the image, there is image 2.
When the cursor is pressed over the image, it changes to image 3 for the brief period that the mouse has been clicked.
Then it changes back to image 2 - or 1, if the user takes the cursor off the image.
I know it has something to do with mouseover etc, but I'm not sure of the code.
Could somebody help me?
Thanks!
-
Something like this
Code:
Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
image1.picture = image3.picture
End Sub
Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
image1.picture = image1.picture
End Sub
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
image1.picture = image2.picture
End Sub
-
Try this
Code:
Option Explicit
Private Sub Form_Load()
ChDrive "C:\"
ChDir "C:\Program Files\Microsoft Visual Studio\Common\Graphics\Icons\Misc\"
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Picture = LoadPicture("FACE02.ICO")
End Sub
Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Picture = LoadPicture("FACE03.ICO")
End Sub
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Picture = LoadPicture("FACE01.ICO")
End Sub
-
Sorry Vlatko! I didn't realize you posted already.
-