开发者

Why the shape of cursor is wrong during my drag-drop operation

开发者 https://www.devze.com 2023-04-06 07:37 出处:网络
I have some code to do drag-drop between items of two list boxes. which I got it to wor开发者_如何学JAVAk finally. so it is doing the drag-drop But the shape of the cursor icon is Wrong. for example w

I have some code to do drag-drop between items of two list boxes. which I got it to wor开发者_如何学JAVAk finally. so it is doing the drag-drop But the shape of the cursor icon is Wrong. for example when I am doing the "drop" on the second list box the icon is still that Stop Circle or whatever its name is. not sure. but yea the icon of the cursor is wrong. Any thoughts how can I fix this?


In the DragEnter event of the ListBox you can set the DragEventArgs.Effect to a DragDropEffects value:

private void ListBox1_DragEnter(object sender, DragEventArgs e)
{
    e.Effect = DragDropEffects.Copy;
}


Not sure what control you are using, but aside from setting the correct DragDropEffect, if you are using the RichTextBox and have EnableAutoDragDrop = true, I noticed some issues where it wants to do a Move from some sources that don't allow it. Holding down [ctrl] switches the dragdrop mode to Copy and allows you to drop it in the target control.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号