如何拖放相同和不同的列表框 [英] How to do drag and drop in same and different listbox
问题描述
我设法使用两个不同的列表框拖放它并且它工作得很好但是如何在同一个列表框中拖放?
对不起,我还是新手。
我尝试了什么:
private void lisBox2_DragDrop(object sender,System.Windows.Forms.DragEventArgs e)
{
if(e.Data.GetDataPresent(DataFormats.StringFormat))
{
string str =(string)e.Data.GetData(DataFormats.StringFormat);
swapBetweenList(selectedIndex,movingIndex);
//lislis2.Items.Add(str);
}
}
使用Drag-and-Drop ListBox [ ^ ]。
/拉维
I manage to do drag and drop using two different listbox and it works good but how to do the drag and drop in the same listbox ?
sorry i still new with this.
What I have tried:
private void lisBox2_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.StringFormat))
{
string str = (string)e.Data.GetData(DataFormats.StringFormat);
swapBetweenList(selectedIndex, movingIndex);
//lisBox2.Items.Add(str);
}
}
Use a Drag-and-Drop ListBox[^].
/ravi
这篇关于如何拖放相同和不同的列表框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!