'首先在form里添加一个panel容器 Dim x1,x2,y1,y2 As Integer '鼠标左键按下后将x1,y1赋值 Private Sub Panel1_MouseDown(ByVal sender As Object,ByVal e As System.@R_403_5087@.Forms.MouseEventArgs) Handles pnlMove.MouseDown If e.button = @R_403_5087@.Forms.Mousebuttons.left Then x1 = e.X y1 = e.Y End If End Sub '拖动过程中不断对x2,y2赋值 Private Sub Panel1_MouseMove(ByVal sender As Object,ByVal e As System.@R_403_5087@.Forms.MouseEventArgs) Handles pnlMove.MouseMove If e.button = @R_403_5087@.Forms.Mousebuttons.left Then x2 = e.X y2 = e.Y Me.left = Me.Location.X + (x2 - x1) Me.top = Me.Location.Y + (y2 - y1) End If End Sub总结
以上是内存溢出为你收集整理的VB.NET自定义标题栏拖动全部内容,希望文章能够帮你解决VB.NET自定义标题栏拖动所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)