欢迎光临
我们一直在努力

VB.NET 拖动无边框的窗体-.NET教程,VB.Net语言

建站超值云服务器,限时71元/月

******************************************

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.mouseup

me.bformdragging = false

end sub

******************************************

private sub form1_mousemove(byval sender as object, byval e as system.windows.forms.mouseeventargs) handles mybase.mousemove

if me.bformdragging then

dim omovetopoint as point

以当前鼠标位置为基础,找出目标位置

omovetopoint = me.pointtoscreen(new point(e.x, e.y))

根据开始位置作出调整

omovetopoint.offset(me.opointclicked.x * -1, _

(me.opointclicked.y + _

systeminformation.captionheight + _

systeminformation.bordersize.height) * -1)

移动窗体

me.location = omovetopoint

end if

end sub

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » VB.NET 拖动无边框的窗体-.NET教程,VB.Net语言
分享到: 更多 (0)