1,451
社区成员
发帖
与我相关
我的任务
分享
Private Sub Form_Load()
Label1(2).Caption = " No mouse found"
End Sub
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Label1(2).Caption = "Mouse arrived" Then Label1(2).Caption = "Mouse left"
End Sub
Private Sub Label1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Index = 2 Then
Label1(2).Caption = "Mouse arrived"
Else
If Label1(2).Caption = "Mouse arrived" Then Label1(2).Caption = "Mouse left"
End If
End Sub
Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Label1(2).Caption = "Mouse arrived" Then Label1(2).Caption = "Mouse left"
End Sub
Option Explicit
Private Sub Form_Load()
'Image 铺满
Me.Image1.Top = 0
Me.Image1.Left = 0
Me.Image1.Width = Me.ScaleWidth
Me.Image1.Height = Me.ScaleHeight
End Sub
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Call SetMouseOnFlag(-1)
End Sub
Private Sub Label1_MouseMove(index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Call SetMouseOnFlag(index)
End Sub
Private Sub SetMouseOnFlag(index As Integer)
Dim i As Integer
For i = Label1.LBound To Label1.UBound
If index = i Then
Label1(i).Tag = 1 '这个属性可以作为其他地方进行判断鼠标是否在上面的标志
Label1(i).FontBold = True
Label1(i).ForeColor = vbRed
Label1(i) = "鼠标在我这"
Else
Label1(i).Tag = -1
Label1(i).FontBold = False
Label1(i).ForeColor = vbBlack
Label1(i) = "找不着鼠标"
End If
Next
End Sub