本文整理汇总了C#中System.Windows.Forms.ListView.DoDragDrop方法的典型用法代码示例。如果您正苦于以下问题:C# ListView.DoDragDrop方法的具体用法?C# ListView.DoDragDrop怎么用?C# ListView.DoDragDrop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ListView
的用法示例。
在下文中一共展示了ListView.DoDragDrop方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: listView_ItemDrag
private void listView_ItemDrag(object sender, ItemDragEventArgs e)
{
ListView listView = sender as ListView;
if (listView == null)
return;
if (listView == lvDisplayedColumns && listView.SelectedItems.Contains(lvDisplayedColumns.Items[0]))
{
MessageBox.Show(this, string.Format("The \"{0}\" column can't be moved!", ((ColumnData)lvDisplayedColumns.Items[0].Tag).Header));
return;
}
mDragStartListView = listView;
mDragStartListView.DoDragDrop(listView.SelectedItems, DragDropEffects.Move | DragDropEffects.Copy);
}
示例2: ItemDragTest
public void ItemDragTest ()
{
Form myform = new Form ();
myform.ShowInTaskbar = false;
ListView mylistview = new ListView ();
mylistview.ItemDrag += new ItemDragEventHandler (ItemDragEventHandler);
mylistview.View = View.Details;
mylistview.SetBounds (10, 10, 200, 200, BoundsSpecified.All);
mylistview.Columns.Add ("A", -2, HorizontalAlignment.Center);
mylistview.Columns.Add ("B", -2, HorizontalAlignment.Center);
ListViewItem item1 = new ListViewItem ("A", -1);
mylistview.Items.Add (item1);
myform.Controls.Add (mylistview);
myform.ShowDialog ();
mylistview.Visible = true;
mylistview.DoDragDrop (mylistview.SelectedItems, DragDropEffects.Link);
Assert.AreEqual (true, eventhandled, "#A7");
myform.Dispose ();
}
示例3: ListView_ItemDrag
private void ListView_ItemDrag(object sender, ItemDragEventArgs e)
{
_dragSource = sender as ListView;
if (_dragSource != null)
_dragSource.DoDragDrop(_dragSource.SelectedItems, DragDropEffects.Move);
}