Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Making a control visible from Form.OnMouseEnter

Making a control visible from Form.OnMouseEnter

Scheduled Pinned Locked Moved C#
question
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jon Hulatt
    wrote on last edited by
    #1

    Hi all, I want to make some controls on my form visible only when the mouse is over the form. To that end, i set Visible=true in the onmouseenter event of the form, and visible=false in the onmouseleave. However, when you move the mouse over the controls that are newly made visible, the onmouseleave event fires and the control is made invisible again. Then, since the control disappears, the onmouseenter event fires again, start a cycle of flickering. Can anyone think of a way round this? I can see no way of telling where the mouse went (ie, did it leave the bounds of the form? or did it enter a control on the form) and thus no way of properly implementing this feature. Any ideas? thanks jon

    using System.Beer;

    E A 2 Replies Last reply
    0
    • J Jon Hulatt

      Hi all, I want to make some controls on my form visible only when the mouse is over the form. To that end, i set Visible=true in the onmouseenter event of the form, and visible=false in the onmouseleave. However, when you move the mouse over the controls that are newly made visible, the onmouseleave event fires and the control is made invisible again. Then, since the control disappears, the onmouseenter event fires again, start a cycle of flickering. Can anyone think of a way round this? I can see no way of telling where the mouse went (ie, did it leave the bounds of the form? or did it enter a control on the form) and thus no way of properly implementing this feature. Any ideas? thanks jon

      using System.Beer;

      E Offline
      E Offline
      ednrgc
      wrote on last edited by
      #2

      Have you tried placing the control on a div, and showing/hiding that?

      J 1 Reply Last reply
      0
      • J Jon Hulatt

        Hi all, I want to make some controls on my form visible only when the mouse is over the form. To that end, i set Visible=true in the onmouseenter event of the form, and visible=false in the onmouseleave. However, when you move the mouse over the controls that are newly made visible, the onmouseleave event fires and the control is made invisible again. Then, since the control disappears, the onmouseenter event fires again, start a cycle of flickering. Can anyone think of a way round this? I can see no way of telling where the mouse went (ie, did it leave the bounds of the form? or did it enter a control on the form) and thus no way of properly implementing this feature. Any ideas? thanks jon

        using System.Beer;

        A Offline
        A Offline
        aamironline
        wrote on last edited by
        #3

        You can avoid flickers but playing with flags...

        M Aamir Maniar aamirOnline.com

        J 1 Reply Last reply
        0
        • E ednrgc

          Have you tried placing the control on a div, and showing/hiding that?

          J Offline
          J Offline
          Jon Hulatt
          wrote on last edited by
          #4

          I'm sorry i wasn't explicit. This is a Windows Forms application, hence the title stating Form.OnMouseEnter. Thanks Jon

          using System.Beer;

          1 Reply Last reply
          0
          • A aamironline

            You can avoid flickers but playing with flags...

            M Aamir Maniar aamirOnline.com

            J Offline
            J Offline
            Jon Hulatt
            wrote on last edited by
            #5

            The flicker is due to the fact that the control is constantly being hidden and unhidden. My form is optimized double buffered anyway.. But the flicker is not my problem here, it's the side effect.

            using System.Beer;

            E 1 Reply Last reply
            0
            • J Jon Hulatt

              The flicker is due to the fact that the control is constantly being hidden and unhidden. My form is optimized double buffered anyway.. But the flicker is not my problem here, it's the side effect.

              using System.Beer;

              E Offline
              E Offline
              ejuanpp
              wrote on last edited by
              #6

              Hi, I suggest you create a class implementing IMessageFilter so that you catch WM_MOUSEMOVE messages. Google for IMessageFilter, Application.AddMessageFilter and Aplication.RemoveMessageFilter :) Regards

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups