Results 1 to 21 of 21

Thread: Move overs

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2001
    Posts
    35

    Move overs

    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

  2. #2
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    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.
    This world is not my home. I'm just passing through.

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2001
    Posts
    35

    images

    Hello

    Yes that worked thanks.

    But how can i have a mouse over for a image.

    Thanks Tim

  4. #4
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    Not quite sure what you mean by a "mouse over". Is that where the image changes its style when the mouse is over it?
    This world is not my home. I'm just passing through.

  5. #5
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    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:
    1. Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2.  
    3.     Image1.BorderStyle = 1
    4.  
    5. End Sub
    6.  
    7. Private Sub Image2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    8.  
    9.     Image1.BorderStyle = 0
    10.  
    11. End Sub
    This world is not my home. I'm just passing through.

  6. #6
    Frenzied Member MerrionComputin's Avatar
    Join Date
    Apr 2001
    Location
    Dublin, Ireland
    Posts
    1,616
    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
    ----8<---------------------------------------
    NEW - The .NET printer queue monitor component
    ----8<---------------------------------------
    Now with Examples of use

  7. #7
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    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:
    1. Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2.     Image1.Picture = "C:\newpic.gif"
    3. End Sub
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  8. #8

    Thread Starter
    Member
    Join Date
    Dec 2001
    Posts
    35

    Mouse Over

    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

  9. #9
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    sorry, i forgot about the LoadPicture function

    here you go


    VB Code:
    1. Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2.     Image1.Picture = LoadPicture("C:\newpic.gif")
    3. End Sub
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  10. #10

    Thread Starter
    Member
    Join Date
    Dec 2001
    Posts
    35

    Mouse Over

    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

  11. #11
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    VB Code:
    1. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2.     If Image1.Picture <> 0 Then Image1.Picture = LoadPicture()
    3. End Sub
    4.  
    5. Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    6.     Image1.Picture = LoadPicture("C:\newpic.gif")
    7. End Sub

    probably more efficient ways, but it works and it's nice and short code.
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  12. #12
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    actually, heres a much better way of doing it.

    VB Code:
    1. Private Sub Form_Load()
    2.     Images(0).Picture = LoadPicture(App.Path & "\image0.gif")
    3.     Images(1).Picture = LoadPicture(App.Path & "\image1.gif")
    4. End Sub
    5.  
    6. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    7.     Images(0).Visible = True
    8.     Images(1).Visible = False
    9. End Sub
    10.  
    11. Private Sub Images_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    12.     If Index = 0 Then
    13.         Images(0).Visible = False
    14.         Images(1).Visible = True
    15.     End If
    16. End Sub


    NOTE: Full example attached...
    Attached Files Attached Files
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  13. #13
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    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.
    This world is not my home. I'm just passing through.

  14. #14

    Thread Starter
    Member
    Join Date
    Dec 2001
    Posts
    35

    Mouse Over

    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

  15. #15

    Thread Starter
    Member
    Join Date
    Dec 2001
    Posts
    35

    End button

    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

  16. #16
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    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.
    Last edited by trisuglow; Feb 20th, 2002 at 10:12 AM.
    This world is not my home. I'm just passing through.

  17. #17

    Thread Starter
    Member
    Join Date
    Dec 2001
    Posts
    35

    Close button

    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
    Attached Files Attached Files

  18. #18
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    I should have said - the vbcode tags need to be enclosed in square brackets in order to work. Sorry!
    This world is not my home. I'm just passing through.

  19. #19
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    Right!

    Delete the End statement from where you've got it and add this procedure.

    Does that work?

    Tris.

    VB Code:
    1. Private Sub Images_Click(Index As Integer)
    2.  
    3.     If Index = 2 Then
    4.         End
    5.     End If
    6.  
    7. End Sub
    This world is not my home. I'm just passing through.

  20. #20

    Thread Starter
    Member
    Join Date
    Dec 2001
    Posts
    35

    Sorry

    Hi sorry dont know how to do that any idea from the code i have pasted, or the zip file.

    thanks Tim

  21. #21

    Thread Starter
    Member
    Join Date
    Dec 2001
    Posts
    35

    Yes Thanks

    Yes thanks that works thanks for all the help.

    Tim

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width