十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
这篇文章主要介绍VB.NET如何拖动窗体,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!
创新互联公司于2013年成立,是专业互联网技术服务公司,拥有项目做网站、成都网站制作网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元南谯做网站,已为上家服务,为南谯各地企业和个人服务,联系电话:18980820575
这是一个使用VB.NET拖动窗体中的拖动无边框的窗体方法,以下为源代码,朋友们可以参考一下
Private oOriginalRegion As
Region = Nothing
' 用于窗体移动
Private bFormDragging As
Boolean = False
Private oPointClicked As Point
Private Sub Form1_MouseDown
(ByVal sender As Object, ByVal
e As System.Windows.Forms.
MouseEventArgs) Handles
MyBase.MouseDown
Me.bFormDragging = True
Me.oPointClicked =
New Point(e.X, e.Y)
End Sub
Private Sub Form1_MouseUp
(ByVal sender As Object, ByVal
e As System.Windows.Forms.
MouseEventArgs) Handles
MyBase.MouseUpMe.bFormDragging = False
End Sub
Private Sub Form1_MouseMove(ByVal
sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs)
Handles MyBase.MouseMoveIf Me.bFormDragging Then
Dim oMoveToPoint As Point
' 以当前鼠标位置为基础,找出目标位置
oMoveToPoint = Me.PointToScreen
(New Point(e.X, e.Y))' 根据开始位置作出调整
oMoveToPoint.Offset(Me.oPoint
Clicked.X * -1, _(Me.oPointClicked.Y + _
SystemInformation.CaptionHeight + _
SystemInformation.BorderSize.
Height) * -1)' 移动窗体
Me.Location = oMoveToPoint
End If
End Sub
以上是“VB.NET如何拖动窗体”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联行业资讯频道!