Menu

GetItemAt() returns incorrect item

Developers
2009-02-26
2013-04-17
  • John Paul O'Gorman

    Hello,

    I am trying to get the correct drag and drop ContainerListViewItem.

    I was using this code successfully to get the drag and drop item. I adjusted the Y point to take into account the header height as without it GetItemAt was returning the node below the one I dropped onto...

    protected override void OnDragDrop(WinForms.DragEventArgs e)
    {
        Point point = this.PointToClient(new Point(e.X, e.Y));
        ContainerListViewItem listViewItem = GetItemAt(point.Y - this.HeaderHeight);
    ...
    }

    I deployed this code to a number of machines and now find that in certain machines it goes into an almost random folder. I cannot tell if it is an operating system issue, .Net framework version, screen resolution etc.

    On the effected machines the following returns the correct item...
    GetItemAt(point.Y);

    Can someone please tell me what is the correct way to get the screen coordinates to pass into the GetItemAt method or give me an idea as to what might be causing this issue.

    I hope you can help. Thank you very much for a great control.

    Kind regards,
    John O'Gorman

     
    • John Paul O'Gorman

      Hello,

      This was happening as a scroll bar was showing that threw out the Y coordinate. I had modify the library to allow access to the vscrollbar and include its value in the GetItemAt calculation...

      GetItemAt(point.Y - this.HeaderHeight + VScrollBar.Value)

      JP

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.