我在2000下实现的文件拖拽,主要用
ON_NOTIFY(LVN_BEGINDRAG, IDC_LIST_FILELIST, OnBegindragListFilelist)
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONUP()
这三个消息。在OnBegindragListFilelist中实现缩略图创建。static CBitmap* bm = NULL;
if(bm!=NULL)
delete bm;
bm = CreateDragThumb();
int nRes = m_ilDrag.Add( bm, bm); // 添加到CImageList中m_ilDrag.BeginDrag( 0, CPoint(nOffset, nOffset - 4));
m_ilDrag.DragEnter( GetDesktopWindow(), pNMListView->ptAction);
m_bDragging = TRUE; //we are in a drag and drop operation
SetCapture ();在OnMouseMove中实现:移动。
m_ilDrag.DragMove(pt); //move the drag image to those coordinates可是上述代码在2000中没有问题,到了XP。就是一块黑图。。不知谁知道是怎么回事?谢谢
ON_NOTIFY(LVN_BEGINDRAG, IDC_LIST_FILELIST, OnBegindragListFilelist)
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONUP()
这三个消息。在OnBegindragListFilelist中实现缩略图创建。static CBitmap* bm = NULL;
if(bm!=NULL)
delete bm;
bm = CreateDragThumb();
int nRes = m_ilDrag.Add( bm, bm); // 添加到CImageList中m_ilDrag.BeginDrag( 0, CPoint(nOffset, nOffset - 4));
m_ilDrag.DragEnter( GetDesktopWindow(), pNMListView->ptAction);
m_bDragging = TRUE; //we are in a drag and drop operation
SetCapture ();在OnMouseMove中实现:移动。
m_ilDrag.DragMove(pt); //move the drag image to those coordinates可是上述代码在2000中没有问题,到了XP。就是一块黑图。。不知谁知道是怎么回事?谢谢
{
CRect rect;
GetWindowRect(swfrect);
CDC* pDC = GetDC();
CDC dc;
dc.CreateDC("DISPLAY",NULL,NULL,NULL);
CBitmap* bm = new CBitmap();
bm->CreateCompatibleBitmap( &dc, rect.Width(), rect.Height());
CDC tdc;
tdc.CreateCompatibleDC(&dc);
CBitmap* pOld = tdc.SelectObject(bm);
tdc.BitBlt(0, 0, rect.Width(),rect.Height(),&dc,rect.left,rect.top,SRCCOPY);
tdc.DeleteDC();
ReleaseDC(pDC);
return bm;
}