Results 1 to 5 of 5

Thread: mouse leave

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2004
    Posts
    8

    mouse leave

    I am using mouse enter/leave to change the back colour of a button. Clicking the button hides the form. When the form is re-displayed mouse enter/leave do not work. I am guessing that this is because the mouse leave event wasn't triggered when the form was hidden. If so is there any way to trigger this event ?

  2. #2
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552
    i don't know much about what are you doing. but i have this and it works.
    VB Code:
    1. 'in form1
    2. dim f as new form2
    3. sub button1_click(sender as object,e as eventargs) handles button1.click
    4.   f.show()
    5. end sub
    6.  
    7. 'and in form2
    8. sub button1_mouseenter(sender as object,e as eventargs) handles button1.mouseenter
    9.   button1.backcolor=color.brown 'monkey, lol
    10. end sub
    11. sub button1_mouseleave(sender as object, e as eventargs) handles button1.mouseleave
    12.   button1.backcolor=nothing
    13. end sub
    14.  
    15. sub bb(sender as object,e as eventargs) handles button1.click
    16.   me.hide()
    17. end sub
    hope i don't bark a wrong tree...

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2004
    Posts
    8
    Thanks brown monkey. If you replace f.show with f.showdialog in your code then mouse enter/leave only work the first time form2 is displayed. Can anyone explain why this is ?

  4. #4
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552
    i don't know much about this but i think it has to do with the instantiation. put dim f as new form2() inside the button click event along with the .showdialog(). it works.

  5. #5

    Thread Starter
    New Member
    Join Date
    Jun 2004
    Posts
    8
    thanks, i agree this works. however i am using a public statement in a module, not a dim statement, for the form. so i am looking for an alternative solution.

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