部分代码如下:void CDragTestDlg::OnBegindragListLeft(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
// TODO: Add your control notification handler code here
m_nDragIndex = pNMListView->iItem;
m_pDragImage = new CImageList();
POINT pt;
pt.x = -10;
pt.y = -10; m_pDragImage=m_listL.CreateDragImage(m_nDragIndex,&pt);
m_pDragImage->SetBkColor(RGB(255,255,255));
m_pDragImage->BeginDrag(0, CPoint(0, 0));
m_pDragImage->DragEnter(GetDesktopWindow(), pNMListView->ptAction); m_bDragging = TRUE;
m_nDropIndex = -1;
m_pDragList = &m_listL;
m_pDropWnd = &m_listL; SetCapture ();
// CClientDC dc(this);
// HICON hIcon=m_pDragImage->ExtractIcon(0);
// dc.DrawIcon(CPoint(0,0),hIcon);
*pResult = 0;
}void CDragTestDlg::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if (m_bDragging)
{
CPoint pt(point);
ClientToScreen(&pt);
m_pDragImage->DragMove(pt);
}
CDialog::OnMouseMove(nFlags, point);
}void CDragTestDlg::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if (m_bDragging)
{
ReleaseCapture ();
m_bDragging = FALSE;
m_pDragImage->DragLeave (GetDesktopWindow ());
m_pDragImage->EndDrag ();
delete m_pDragImage;
}
CDialog::OnLButtonUp(nFlags, point);
}
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
// TODO: Add your control notification handler code here
m_nDragIndex = pNMListView->iItem;
m_pDragImage = new CImageList();
POINT pt;
pt.x = -10;
pt.y = -10; m_pDragImage=m_listL.CreateDragImage(m_nDragIndex,&pt);
m_pDragImage->SetBkColor(RGB(255,255,255));
m_pDragImage->BeginDrag(0, CPoint(0, 0));
m_pDragImage->DragEnter(GetDesktopWindow(), pNMListView->ptAction); m_bDragging = TRUE;
m_nDropIndex = -1;
m_pDragList = &m_listL;
m_pDropWnd = &m_listL; SetCapture ();
// CClientDC dc(this);
// HICON hIcon=m_pDragImage->ExtractIcon(0);
// dc.DrawIcon(CPoint(0,0),hIcon);
*pResult = 0;
}void CDragTestDlg::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if (m_bDragging)
{
CPoint pt(point);
ClientToScreen(&pt);
m_pDragImage->DragMove(pt);
}
CDialog::OnMouseMove(nFlags, point);
}void CDragTestDlg::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if (m_bDragging)
{
ReleaseCapture ();
m_bDragging = FALSE;
m_pDragImage->DragLeave (GetDesktopWindow ());
m_pDragImage->EndDrag ();
delete m_pDragImage;
}
CDialog::OnLButtonUp(nFlags, point);
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货