icon expand in drag mode

User avatar
sal21
PlatinumLounger
Posts: 4350
Joined: 26 Apr 2010, 17:36

icon expand in drag mode

Post by sal21 »

Code: Select all

Private Sub ListView1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)

    Set ListView1.SelectedItem = ListView1.HitTest(x, y)

    ' In the following line any ICO file will do
    ListView1.DragIcon = LoadPicture(AppPath & "HelloSir.ICO")

    ListView1.Drag vbBeginDrag
    
End Sub
Why when i click on listview item the icon expands!

i need to maintain the same dimension, in other case, show a little cursor

User avatar
HansV
Administrator
Posts: 78410
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: icon expand in drag mode

Post by HansV »

Sorry, no idea.
Best wishes,
Hans

User avatar
SpeakEasy
4StarLounger
Posts: 544
Joined: 27 Jun 2021, 10:46

Re: icon expand in drag mode

Post by SpeakEasy »

>Why when I click on listview item the icon expands!

Because the drag icon used by VB is in fact an old style system cursor, limited to being exactly 32 * 32 pixels (and only 256 colours, as I recall). It will resize any ico resources that you throw at it to this size. The Listview and the ImageList also do their own scaling, just to confuse things. Unfortunately, don't know any easy way around this,