T
Thomas
Hi,
This may not be the right place, but it seems like a good starting point so
here goes:
I am trying to scroll the listview during a drag drop operation. I have the
drag drop part working, but the scrolling is trouble. How can I set the
scroll to follow my mouse position while dragging. I have tried to send
messages to the listview but this method is crashing. Can I use a
sendmessage like:
SendMessage((HWND)Handle.ToPointer(), LVM_SETITEMPOSITION32,
selection->Index, (LPARAM)&targetPoint);
Do I need to marshal the hwnd or lparam? Is there any other way to do this?
Here is a snippet of my code to illustrate what I am trying to do:
private: System::Void listView1_DragOver(Object* /*sender*/, DragEventArgs*
e)
{
// Retrieve the client coordinates of the mouse position.
Point targetPoint = listView1->PointToClient(Point(e->X, e->Y));
ListViewItem* selection = listView1->GetItemAt(e->X, e->Y);
SendMessage((HWND)listView1->Handle.ToPointer(), LVM_SETITEMPOSITION32,
selection->Index, (LPARAM)&targetPoint);
}
This may not be the right place, but it seems like a good starting point so
here goes:
I am trying to scroll the listview during a drag drop operation. I have the
drag drop part working, but the scrolling is trouble. How can I set the
scroll to follow my mouse position while dragging. I have tried to send
messages to the listview but this method is crashing. Can I use a
sendmessage like:
SendMessage((HWND)Handle.ToPointer(), LVM_SETITEMPOSITION32,
selection->Index, (LPARAM)&targetPoint);
Do I need to marshal the hwnd or lparam? Is there any other way to do this?
Here is a snippet of my code to illustrate what I am trying to do:
private: System::Void listView1_DragOver(Object* /*sender*/, DragEventArgs*
e)
{
// Retrieve the client coordinates of the mouse position.
Point targetPoint = listView1->PointToClient(Point(e->X, e->Y));
ListViewItem* selection = listView1->GetItemAt(e->X, e->Y);
SendMessage((HWND)listView1->Handle.ToPointer(), LVM_SETITEMPOSITION32,
selection->Index, (LPARAM)&targetPoint);
}