本帖最后由 u014325761 于 2014-07-17 02:33:40 编辑

解决方案 »

  1.   

    // Add bitmap to imagelist
                this.imageListDrag.Images.Add(bmp);
                 
                // Get mouse position in client coordinates
                Point p = this.treeView1.PointToClient(Control.MousePosition);
     
                // Compute delta between mouse position and node bounds
                int dx = p.X + this.treeView1.Indent - this.dragNode.Bounds.Left;
                int dy = p.Y - this.dragNode.Bounds.Top;
    应该是list控件大小的问题你再放大点看看,坐标的位置X取得小一些
      

  2.   

    不行啊,treeView1只要不放在panel1, 任意大小,任意位置都有拖动效果
      

  3.   

    我想问题出在这里DragHelper.ImageList_BeginDrag(this.imageListDrag.Handle, 0, dx, dy)BOOL WINAPI ImageList_BeginDrag(
      HIMAGELIST himlTrack, 
      int iTrack, 
      int dxHotspot, 
      int dyHotspot 
    );dxHotspotand dyHotspot
    [in] Specifies the location of the drag position relative to the upper-left corner of the image.
    //  dx, dy 是相对于父窗口的坐标,放在容器里他就把容器当作父做口了,容器位置改变是,图像就发生偏移了. 
    但是这个坐标这么转换呢?