明輝手游網(wǎng)中心:是一個免費提供流行視頻軟件教程、在線學(xué)習(xí)分享的學(xué)習(xí)平臺!

容器中控件的拖動

[摘要]Private Sub PictureBox2_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox2.MouseDown Me.Pi...
 Private Sub PictureBox2_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox2.MouseDown

        Me.PictureBox2.DoDragDrop(sender, DragDropEffects.Move)

 

    End Sub

 

    Private Sub GroupBox1_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles GroupBox1.DragEnter

        e.Effect = DragDropEffects.Move '拖放事件的目標(biāo)所允許的動作

 

    End Sub

 

    Private Sub GroupBox1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles GroupBox1.DragDrop

 

        Me.PictureBox1.Controls.Remove(Me.PictureBox2)

        Me.GroupBox1.Controls.Add(Me.PictureBox2)

        Me.PictureBox2.Left = 0

        Me.PictureBox2.Top = 10

        MessageBox.Show("dfgdf")

    End Sub

 

    Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Me.GroupBox1.AllowDrop = True

        Me.PictureBox1.AllowDrop = True

 

    End Sub





標(biāo)簽:容器中控件的拖動