Hallo Leute ![^^](https://www.vb-paradise.de/wcf/images/smilies/grin.png)
Ich wollte gern mal wissen ob es möglich ist ein Label an den Cursor an zu hängen, so das er sich ohne drag mit bewegt.
Danke im vorraus![^^](https://www.vb-paradise.de/wcf/images/smilies/grin.png)
hier mein code:
Dim pl, cl As New Point
Private Sub ren()
pl = Label1.Location
cl = Cursor.Position
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label1.Location = pl - cl + Cursor.Position
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Location = Cursor.Position
End Sub
Private Sub Form2_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseEnter
Timer1.Enabled = True
Timer1.Start()
ren()
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Label1.Text = Cursor.Position.ToString
End Sub
![^^](https://www.vb-paradise.de/wcf/images/smilies/grin.png)
Ich wollte gern mal wissen ob es möglich ist ein Label an den Cursor an zu hängen, so das er sich ohne drag mit bewegt.
Danke im vorraus
![^^](https://www.vb-paradise.de/wcf/images/smilies/grin.png)
hier mein code:
Dim pl, cl As New Point
Private Sub ren()
pl = Label1.Location
cl = Cursor.Position
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label1.Location = pl - cl + Cursor.Position
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Location = Cursor.Position
End Sub
Private Sub Form2_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseEnter
Timer1.Enabled = True
Timer1.Start()
ren()
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Label1.Text = Cursor.Position.ToString
End Sub