Solved

CListView: multi-sel dragging

Posted on 1997-11-11
3
368 Views
Last Modified: 2013-11-19
In my owner-draw CListView, when I start dragging an element (in report view), I create the drag image by:

GetListCtrl().CreateDragImage(m_nDragIndex,&point);

but the resulting drag image includes only the bitmap and not the label text.

Besides this, I need to drag a multiple selection from as CListCtrl. The documentation only refers to a single-element drag (LVN_BEGINDRAG, CreateDragImage, etc..) How can I get the dragging image of a multiple selection?

Tnx

Fabio Marzocca
0
Comment
Question by:winmeister
  • 2
3 Comments
 
LVL 8

Expert Comment

by:gelbert
ID: 1309773
When you drag more than one item then you have to use bitmap which is not associated with any of items on the list ( just keep custom bitmap in resources specially for this purpose and use it index in CreateDragImage() call). And if you really want to move text with bitmap when you do drag and drop then in OnMouseMove() or OnDraw() you have to draw/erase text near of current mouse position during drag and drop.
0
 
LVL 1

Author Comment

by:winmeister
ID: 1309774
I cannot have a custom bitmap for multi-sel, as it should be sized to the selection extension. I mean, I need to drag a multi-sel as Windows Explorer does in its right pane.

Concerning the text label, the example MFCDrag does not draw/erase text close to the mouse position, and the drag image is complete...
0
 
LVL 8

Accepted Solution

by:
gelbert earned 50 total points
ID: 1309775
 Good news is that if you can use CListCtrl::RedrawItem() to paint item(bitmap+text) when it is draged. See mfcdrag sample, file listview.cpp function OnMouseMove().
    There is no function to call to get exactly the same effect as you see Windows Explorer. So you would have to try to use RedrawItem to display drag item(s). Otherwise you have to imitate drag and drop cursor by painting Explorer-like grid by yourseft.

0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Question regarding Copy/Paste 16 96
format the code in java 6 93
Window placement 17 82
Thin secure Windows 10 5 95
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question