当前位置:系统之家 > 技术开发教程 > 详细页面

容器中控件的拖动

容器中控件的拖动

更新时间:2022-11-09 文章作者:未知 信息来源:网络 阅读次数:

 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 '拖放事件的目标所允许的动作

 

    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


温馨提示:喜欢本站的话,请收藏一下本站!

本类教程下载

系统下载排行