-
Question on right click.
Does anybody know the code I can use for
1. selecting a listitem with the right click. I'm useing the listbox control not the Listview control.
2.And how can I hightlight that line or make that text bold .
Any help would be grately appriciated.
Regards,
[email protected]
-
Code:
Private Declare Function LBItemFromPt Lib "comctl32.dll" (ByVal hLB As Long, ByVal ptx As Long, ByVal pty As Long, ByVal bAutoScroll As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Sub Form_Load()
For i = 0 To 10
List1.AddItem "Number" & i
Next i
End Sub
Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim nPos As Integer
Dim PT As POINTAPI
GetCursorPos PT
nPos = LBItemFromPt(List1.hWnd, PT.X, PT.Y, 0)
List1.Selected(nPos) = True
End Sub