Author Topic: mouse pointer change  (Read 1455 times)

Darrell

  • Full Member
  • ***
  • Posts: 198
  • Electrician / PLC Technician
    • View Profile
mouse pointer change
« on: March 06, 2017, 01:15:31 AM »
Is there a way to get the mouse pointer to change, lets say to a hand , when it is hovered over something that can be clicked

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5325
    • View Profile
    • AdvancedHMI
Re: mouse pointer change
« Reply #1 on: March 06, 2017, 03:53:53 AM »
Here is one way of doing it for a button:
Code: [Select]
    Private Sub Button1_MouseEnter(sender As Object, e As EventArgs) Handles Button1.MouseEnter
        Cursor = Cursors.Hand
    End Sub

    Private Sub Button1_MouseLeave(sender As Object, e As EventArgs) Handles Button1.MouseLeave
        Cursor = Cursors.Arrow
    End Sub

You add additional controls to this same code by adding to the Handles list. For example:

    Private Sub Button1_MouseEnter(sender As Object, e As EventArgs) Handles Button1.MouseEnter, Button2.MouseEnter, Button2.MouseEnter