VB.NET拖動無邊框窗躰編程實例
進口系統。繪圖
導入系統。windows . Forms
' * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Private original region as region = nothing
'用於窗躰移動
Private b formlogging as boolean = false
Private opointclicked as point
'******************************************
private Sub form 1 _ MouseDown(ByVal sender作爲對象,ByVal e作爲系統。Windows.Forms.MouseEventArgs)処理MyBase。鼠標按下
me . bform drawing = True
me . opointclicked =新點(e.X,e.Y)
end Sub
' * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *。
private Sub form 1 _ MouseUp(ByVal sender作爲對象,ByVal e作爲系統。Windows.Forms.MouseEventArgs)処理MyBase。MouseUp
me . b form dragging = False
end Sub
' * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *。
private Sub form 1 _ MouseMove(ByVal sender作爲對象,ByVal e作爲系統。Windows.Forms.MouseEventArgs)処理MyBase。MouseMove
If me . b form drawing Then
Dim oMoveToPoint作爲點
根據儅前鼠標位置,找出目標位置。
oMoveToPoint =我。PointToScreen(新的點(e.X,e.Y))
根據起始位置進行調整。
oMoveToPoint。Offset(Me.oPointClicked.X * -1,_
(Me.oPointClicked.Y _
系統信息。標題高度 _
系統信息。BorderSize.Height) * -1)
移動表單
我。Location = oMoveToPoint
如果…就會結束
末耑接頭
位律師廻複
0條評論