Hello
I have made a image to close my program how do i make a mouse over for this image
and how do you make the text popup saying close.
Thanks Tim
Printable View
Hello
I have made a image to close my program how do i make a mouse over for this image
and how do you make the text popup saying close.
Thanks Tim
Are you talking about tooltip text? If so, just write "Close" in the tooltip property of the Image.
Otherwise, I don't understand your problem - can you give me some more information?
Tris.
Hello
Yes that worked thanks.
But how can i have a mouse over for a image.
Thanks Tim
Not quite sure what you mean by a "mouse over". Is that where the image changes its style when the mouse is over it?
If I'm right then you really need to use some API calls.
However, here's the cheap way of doing it.
Make Image2 cover your entire form and send it behind all the other controls.
Image 1 is the control that you are animating when the mouse goes over it.
This is the cheap method because if you hover the mouse over Image1 then move it off your form really fast the _MouseMove event for Image2 may not get fired.
VB Code:
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Image1.BorderStyle = 1 End Sub Private Sub Image2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Image1.BorderStyle = 0 End Sub
Check out the MCL Region button download (with source) from Merrion Computing
This allows you to have a button with different images defined for up/down/disabled and hover states and handles the clipping and painting of this automatically....
HTH,
Duncan
i think he wants to just change the image to another file when he moves the mouse over the image control.
in JavaScript you use the OnMouseOver event do to that...
in vb...
VB Code:
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Image1.Picture = "C:\newpic.gif" End Sub
hi
Yes it is like in javescript
I tryed this code
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Picture = "C:\newpic.gif"
End Sub
But got a error saying mismach
Any other ideas tryed the other code on thsi post but to hard for me.
Thanks Tim
sorry, i forgot about the LoadPicture function :rolleyes:
here you go
VB Code:
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Image1.Picture = LoadPicture("C:\newpic.gif") End Sub
Hi thanks that worked
sorry one more thing i need it to change back to the image it was after they take the mouse off the image.
Thanks Tim
VB Code:
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If Image1.Picture <> 0 Then Image1.Picture = LoadPicture() End Sub Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Image1.Picture = LoadPicture("C:\newpic.gif") End Sub
probably more efficient ways, but it works and it's nice and short code.
actually, heres a much better way of doing it.
VB Code:
Private Sub Form_Load() Images(0).Picture = LoadPicture(App.Path & "\image0.gif") Images(1).Picture = LoadPicture(App.Path & "\image1.gif") End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Images(0).Visible = True Images(1).Visible = False End Sub Private Sub Images_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) If Index = 0 Then Images(0).Visible = False Images(1).Visible = True End If End Sub
NOTE: Full example attached...
darre1's suggestion before last is an improvement on what I was suggesting earlier, but still suffers from the same problem. If your control is close to the edge of the form and you move your mouse off really quickly then the Form_MouseMove event doesn't fire.
Hello one little problem sorry
using this code
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Imgclose.Picture <> 0 Then Imgclose.Picture = LoadPicture()
End Sub
Private Sub Imgclose_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Imgclose.Picture = LoadPicture("C:\Windows\desktop\riskfree\images\minimize.jpg")
End Sub
the first picture dont show up only when i mouse over image works.
Thanks tim
Hello this code works well.
Private Sub Form_Load()
Images(0).Picture = LoadPicture(App.Path & "\image0.jpg")
Images(2).Picture = LoadPicture(App.Path & "\image1.jpg")
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Images(0).Visible = True
Images(2).Visible = False
End Sub
Private Sub Images_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Index = 0 Then
Images(0).Visible = False
Images(2).Visible = True
End If
End Sub
But how can i use this code to close the program i hadded
End into the code but then it just shuts the program with out the mouse over and no need to click.
thanks Tim
Is your source code small enough to post it all so we can have a look?
If not, where are you putting your End statement? Is it in Images_Click()?
BTW, can you enclose your code postings between vbcode and /vbcode tags please?
Tris.
Hello
here is the code
vbcode
'Move form code part1 :
Private Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Sub ReleaseCapture Lib "User32" ()
' End move form code part1 :
Option Explicit
Private Sub Form_Load()
Images(0).Picture = LoadPicture(App.Path & "\image0.jpg")
Images(2).Picture = LoadPicture(App.Path & "\image1.jpg")
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Images(0).Visible = True
Images(2).Visible = False
End Sub
Private Sub Images_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Index = 0 Then
Images(0).Visible = False
Images(2).Visible = True
End If
End
End Sub
'Move form code part2 :
Private Sub Imgtop_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Const WM_NCLBUTTONDOWN = &HA1
Const HTCAPTION = 2
If Button = 1 Then
ReleaseCapture
SendMessage Me.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
End If
End Sub
'End move form code part2 :
/vbcode
And i have included a zip of the program so you can see what i mean move the mouse over the close button.
Thanks Tim
I should have said - the vbcode tags need to be enclosed in square brackets in order to work. Sorry!
Right!
Delete the End statement from where you've got it and add this procedure.
Does that work?
Tris.
VB Code:
Private Sub Images_Click(Index As Integer) If Index = 2 Then End End If End Sub
Hi sorry dont know how to do that any idea from the code i have pasted, or the zip file.
thanks Tim
Yes thanks that works thanks for all the help.
Tim