Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CreateImageEx problem with CListCtrl drag and drop

CreateImageEx problem with CListCtrl drag and drop

Scheduled Pinned Locked Moved C / C++ / MFC
help
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bhanu_8509
    wrote on last edited by
    #1

    Dear All, I have problem with the CListCtrl drag and drop. I used the CreateImageEx to display the image while dragging the contents of the CListCtrl but unfortunately the image is displaying at the left top corner of the screen and not relevant to my GUI where the CListCtrl is placed. The following is the code snippet. Please advice why the image is displayed like that.

    //call to the dragging method
    void TestDlg::OnLvnBeginrdragList3(NMHDR *pNMHDR, LRESULT *pResult)
    {
    LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
    OnBegindrag(&pList, pNMHDR);
    *pResult = 0;
    }

    //Dragging method
    void TestDlg::OnBegindrag(CListCtrl* pList, NMHDR* pNMHDR)
    {
    NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
    if (pList->GetSelectedCount() <= 0)
    return; // No row selected
    int iItem = pList->GetSelectedCount();
    POINT pt;
    m_pDragImage = CreateDragImageEx(pList, &pt);
    if (m_imageList == NULL)
    return;
    m_pDragWnd = pList;
    CPoint ptStart = pNMListView->ptAction;
    ptStart -= pt;
    m_pDragImage->BeginDrag(0, ptStart);
    m_pDragImage->DragEnter(GetDesktopWindow(), pNMListView->ptAction);
    SetCapture();
    }

    B 1 Reply Last reply
    0
    • B bhanu_8509

      Dear All, I have problem with the CListCtrl drag and drop. I used the CreateImageEx to display the image while dragging the contents of the CListCtrl but unfortunately the image is displaying at the left top corner of the screen and not relevant to my GUI where the CListCtrl is placed. The following is the code snippet. Please advice why the image is displayed like that.

      //call to the dragging method
      void TestDlg::OnLvnBeginrdragList3(NMHDR *pNMHDR, LRESULT *pResult)
      {
      LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
      OnBegindrag(&pList, pNMHDR);
      *pResult = 0;
      }

      //Dragging method
      void TestDlg::OnBegindrag(CListCtrl* pList, NMHDR* pNMHDR)
      {
      NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
      if (pList->GetSelectedCount() <= 0)
      return; // No row selected
      int iItem = pList->GetSelectedCount();
      POINT pt;
      m_pDragImage = CreateDragImageEx(pList, &pt);
      if (m_imageList == NULL)
      return;
      m_pDragWnd = pList;
      CPoint ptStart = pNMListView->ptAction;
      ptStart -= pt;
      m_pDragImage->BeginDrag(0, ptStart);
      m_pDragImage->DragEnter(GetDesktopWindow(), pNMListView->ptAction);
      SetCapture();
      }

      B Offline
      B Offline
      bhanu_8509
      wrote on last edited by
      #2

      Please anybody help me!!!

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups