窗体是指由两个列表框(ListBox1、ListBox2)和4个命令按钮(Button1“”按钮,Button2“”按钮,Button3“”按钮,Button4“”按钮)所构成的界面,代码:
创新互联专注于南山网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供南山营销型网站建设,南山网站制作、南山网页设计、南山网站官网定制、微信平台小程序开发服务,打造南山网络公司原创品牌,更为您提供南山网站排名全网营销落地服务。
Public Class Form1
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Me.Text = "选项移动"
ListBox1.SelectionMode = SelectionMode.MultiSimple
ListBox2.SelectionMode = SelectionMode.One
For i = 1 To 10
ListBox1.Items.Add(Chr(Asc("a") + i - 1))
Next
For i = 1 To 10
ListBox2.Items.Add(i.ToString)
Next
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
If ListBox1.SelectedItems Is Nothing Then Exit Sub
Dim b As ListBox.ObjectCollection
For i = 0 To Me.ListBox1.SelectedItems.Count - 1
Me.ListBox2.Items.Add(Me.ListBox1.SelectedItems(0))
Me.ListBox1.Items.RemoveAt(Me.ListBox1.SelectedIndices(0))
Next
End Sub
Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
If ListBox2.SelectedItems IsNot Nothing Then
ListBox1.Items.Add(ListBox2.SelectedItem)
ListBox2.Items.Remove(ListBox2.SelectedItem)
End If
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
For Each itm As Object In ListBox1.Items
ListBox2.Items.Add(itm)
Next
ListBox1.Items.Clear()
End Sub
Private Sub Button4_Click(sender As System.Object, e As System.EventArgs) Handles Button4.Click
For Each itm As Object In ListBox2.Items
ListBox1.Items.Add(itm)
Next
ListBox2.Items.Clear()
End Sub
End Class
您好,建议您使用mouse_event或者 Cursor.Position来实现。例如:
1. 您需要将鼠标移动dx, dy的位置。
Public Sub MouseMoveBy(ByVal dx As Integer, ByVal dy As Integer)
Cursor.Position = New Point(Cursor.Position.X + dx, Cursor.Position.Y + dy)
End Sub
或者
Public Sub MouseMoveBy(ByVal dx As Integer, ByVal dy As Integer)
mouse_event(0, dx, dy, 0, 0)
End Sub
2. 您需要将鼠标移动到x, y的位置
Public Sub MouseMoveTo(ByVal x As Integer, ByVal y As Integer)
Cursor.Position = New Point(x, y)
End Sub
请您试一下。
Microsoft.VisualBasic.FileSystem.Rename(原文件夹完整路径名称,新的文件夹名称)
Microsoft.VisualBasic.FileSystem.Rename("D:\1", "D:\2\1")‘当路径不对时会把原文件夹剪切到“D:\2\”下面文件夹名称不变
Microsoft.VisualBasic.FileSystem.Rename("D:\1", "D:\2\2")")‘当路径不对时会把原文件夹剪切到“D:\2\”下面文件夹名称 更改为 2
Microsoft.VisualBasic.FileSystem.Rename("D:\1", "D:\2")’当路径相同时只改文件夹名称 不移动文件