******************************************
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