技術(shù) 點(diǎn)
- 技術(shù)
- 點(diǎn)
- V幣
- 點(diǎn)
- 積分
- 18
|
2#

樓主 |
發(fā)表于 2025-3-15 09:38:50
|
只看該作者
Private Sub 用戶_List_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'用戶數(shù)量在20個(gè)時(shí)
Dim hoverIndex As Long
Dim hoverValue As String
Dim textheight
textheight = 315 '315為組合框單條文本的高度
' 計(jì)算鼠標(biāo)懸停的選項(xiàng)索引
If Y < textheight Then
hoverIndex = 0
ElseIf Y Mod 300 = 0 Then
hoverIndex = Int(Y / 300) - 1
Else
hoverIndex = Int(Y / 300)
End If
If hoverIndex >= 0 And hoverIndex < Me.用戶_List.ListCount Then
' 獲取懸停選項(xiàng)的值
hoverValue = Me.用戶_List.ItemData(hoverIndex)
' 將值顯示在文本框中
Me.txtUser.Value = hoverValue
End If
End Sub |
|