首页  电脑故障排除  病毒安全 电脑基础知识  硬件知识  软件应用知识  操作系统知识  编程程序

美国编程网址 日本编程网址 法国编程网址 德国编程网址 韩国编程网址 香港编程网址 台湾编程网址

您的位置:首页>>编程程序>>NET

轻松实现控件间托拽操作

 
轻松实现控件间托拽操作

> ListBox1.Items.Add("Item " & i)
Next
ListBox2.AllowDrop = True
End Sub
Private Sub ListBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListBox1.MouseDown
Dim itemIndex As Integer
itemIndex = ListBox1.IndexFromPoint(e.X, e.Y)
If itemIndex >= 0 Then
ListBox1.DoDragDrop(ListBox1.Items(itemIndex), DragDropEffects.Copy)
End If
End Sub
Private Sub ListBox2_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListBox2.DragEnter
If (e.Data.GetDataPresent(DataFormats.Text)) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.None
End If
End Sub
Private Sub ListBox2_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListBox2.DragDrop
Dim sItem As String
sItem = e.Data.GetData(DataFormats.Text).ToString
ListBox2.Items.Add(sItem)
ListBox1.Items.RemoveAt(ListBox1.FindString(sItem))
End Sub
  
  
  
1页 > 2页 >   

查看上一页  返回分类首页 返回96PC首页  查看下一页

  版权所有:电脑知识大全 网站备案:粤ICP备07031496号  联系我们

友情链接:母婴知识  外贸商务网  娱乐频道  汽车维修知识  股票入门知识  游戏攻略秘籍  本站空间由安信网络提供