How to mimic MouseEnter event?

Alec Pointer 20 Reputation points
2023-02-05T06:12:21.58+00:00

Hello,

When I move the mouse pointer over a Button it will highlight, is it possible to trigger this mode from code, so it seems like the mouse is over the Button?

Primary vb.net 2010 .net 4.0

Thank you

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,570 questions
{count} votes

1 answer

Sort by: Most helpful
  1. LesHay 7,126 Reputation points
    2023-02-05T12:52:51.4166667+00:00

    Hi

    Well, the term 'mode' is meaningless in this context. You can simulate a mouse move to a Control (lets say Button4) just by calling the Sub MM with the Control name.

    e.g. MM(Button4) which would position the mouse pointer onto the control.

      Sub MM(c As Control)
        Cursor.Position = PointToScreen(New Point(c.Left + c.Width \ 2, c.Top + c.Height \ 2))
      End Sub
    
    
    0 comments No comments