Results 1 to 2 of 2

Thread: Question on right click.

  1. #1

    Thread Starter
    Hyperactive Member Dasiths's Avatar
    Join Date
    Apr 2001
    Location
    Colombo, Sri Lanka
    Posts
    331

    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]
    It is the mark of an instructed mind to rest satisfied with the degree of precision which the nature of the subject admits, and not to seek exactness when only an approximation of the truth is possible.
    -Aristotle As quoted in Rapid Development, chapter 8, page 167.

  2. #2
    Megatron
    Guest
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width