สร้าง ListBox 1 อัน TextBox 1 อัน ใส่โค้ด
ListBox ตั้ง Style เป็น CheckBox
ListBox ตั้ง Style เป็น CheckBox
โค๊ด: [Select]
Option Explicit
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hWnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long
Const LB_ITEMFROMPOINT = &H1A9
Function MAKELPARAM(ByVal X As Integer, ByVal Y As Integer) As Long
MAKELPARAM = CInt(Y) * (2 ^ 16) Or CInt(X)
End Function
Private Sub List1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim CoordX As Long, CoordY As Long, Coord As Long, FPoint As Long
Dim txt As String
CoordX = X Screen.TwipsPerPixelX
CoordY = Y Screen.TwipsPerPixelY
Coord = MAKELPARAM(CInt(CoordX), CInt(CoordY))
FPoint = SendMessage(List1.hWnd, LB_ITEMFROMPOINT, 0, ByVal Coord)
If FPoint <= List1.ListCount - 1 Then
txt = List1.List(FPoint)
Select Case txt
Case List1.List(0)
Text1.Text = "ICheer_No0M"
Case List1.List(1)
Text1.Text = "ITD-TEAM"
Case List1.List(2)
Text1.Text = "IT-DARK.ORG"
End Select
End If
End Sub