VB6.0用掲示板の過去のログ(No.1)−VBレスキュー(花ちゃん)
[記事リスト] [新規投稿] [新着記事] [ワード検索] [過去ログ] [管理用]

投稿日: 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


- 関連一覧ツリー (★ をクリックするとツリー全体を一括表示します)

- 返信フォーム (この記事に返信する場合は下記フォームから投稿して下さい)

- Web Forum -