投稿日 | : 2003/09/06(Sat) 09:26 |
投稿者 | : 花ちゃん |
Eメール | : |
URL | : |
タイトル | : Re: リストボックスで右クリック |
こう言う事でしょうか?
Option Explicit
Private Declare Function LBItemFromPt Lib "comctl32" _
(ByVal hLB As Long, ByVal x As Long, ByVal y As Long, _
ByVal bAutoScroll As Long) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" _
(lpPoint As POINTAPI) As Long
Private Sub List1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbRightButton Then
Dim MPos As POINTAPI
Dim LstIndex As Long
GetCursorPos MPos
LstIndex = LBItemFromPt(List1.hWnd, MPos.x, MPos.y, False)
If LstIndex <> -1 Then
List1.Selected(LstIndex) = True
'Debug.Print List1.Text
End If
End If
End Sub