DO NOT DEAL WITH THIS MEMBER
Nov 23, 2018 07:28 PM
(This post was last modified: Nov 24, 2018 06:41 AM by NYANxCAT.)
as you can see above, by default you can't press an item and select the next item. this code should fix the issue.
Code Private mouseDownLV1 As Boolean
Private Sub LV1_MouseDown(sender As Object, e As MouseEventArgs) Handles LV1.MouseDown
mouseDownLV1 = True
End Sub
Private Sub LV1_MouseMove(sender As Object, e As MouseEventArgs) Handles LV1.MouseMove
If mouseDownLV1 Then
Try
LV1.Items(LV1.HitTest(e.Location).Item.Index).Selected = True
Catch : End Try
End If
End Sub
Private Sub LV1_MouseUp(sender As Object, e As MouseEventArgs) Handles LV1.MouseUp
mouseDownLV1 = False
End Sub
Edit:
Better version
Code Private Sub LV1_MouseMove(sender As Object, e As MouseEventArgs) Handles LV1.MouseMove
Dim hitInfo = LV1.HitTest(e.Location)
If e.Button = MouseButtons.Left AndAlso (hitInfo.Item IsNot Nothing OrElse hitInfo.SubItem IsNot Nothing) Then listView1.Items(hitInfo.Item.Index).Selected = True
End Sub
Or you can click to the first item, hold shift, then click to the last item you want to be selected.
Nice tricks, anyway.
DO NOT DEAL WITH THIS MEMBER
(Nov 23, 2018 11:08 PM)Vyxn Wrote: Or you can click to the first item, hold shift, then click to the last item you want to be selected.
Nice tricks, anyway.
True, but the idea is to press and select without a keyboard.
Thank for sharing the code snipet! Like it!
What about set Listview.MultiSelect = true;
Nov 24, 2018 03:25 PM
(This post was last modified: Nov 24, 2018 07:53 PM by Steve.)
(Nov 24, 2018 05:23 AM)NYANxCAT Wrote: True, but the idea is to press and select without a keyboard. ^^
(Nov 24, 2018 03:09 PM)cristlol Wrote: What about set Listview.MultiSelect = true;
^^
[warn]
Be Nice For Once 15hVUVz7xA4kazHdk2BuErENGCskVwjYXP
DO NOT DEAL WITH THIS MEMBER
(Nov 24, 2018 03:09 PM)cristlol Wrote: What about set Listview.MultiSelect = true;
Listview.MultiSelect It will only work if you select without selecting an item first. As you see in the image above, I'm selecting an item then move to the next item.
(Nov 24, 2018 05:23 AM)NYANxCAT Wrote: True, but the idea is to press and select without a keyboard.
I liked your idea man.
Pretty interesting and cool example.
I'm glad you're moving away from try-catch statements and checking for null, this is a big deal. Also thanks for sharing with the community.
Nice share... Thanks buddy...
BTC - bc1q3efew3yzfwhdz290dafykaw0a2w56g2j69g2c6
ETH - 0xf1c873217032468990D3313da6509D1b813c4671
USDT - 0xf1c873217032468990D3313da6509D1b813c4671
PP - [email protected]
|