Dim theScreen As Rectangle
Dim MousX AsShort Dim MousY AsShort Dim CurrX AsShort Dim CurrY AsShort Dim MoveScreen AsBoolean PrivateSub Form1_Load()Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
theScreen = Screen.PrimaryScreen.Bounds()
Me.Location =New Point((theScreen.Width - Me.Width) /2, (theScreen.Height - Me.Height) /2)
End Sub PrivateSub Form1_MouseMove()Sub Form1_MouseMove(ByVal sender AsObject, ByVal e As System.Windows.Forms.MouseEventArgs) HandlesMyBase.MouseMove
CurrX = Me.Left- MousX + e.X
CurrY = Me.Top - MousY + e.Y
If MoveScreen =TrueThen Me.Location =New Point(CurrX, CurrY)
EndIf End Sub PrivateSub Form1_MouseDown()Sub Form1_MouseDown(ByVal sender AsObject, ByVal e As System.Windows.Forms.MouseEventArgs) HandlesMyBase.MouseDown
MousX = e.X
MousY = e.Y
MoveScreen =True End Sub PrivateSub Form1_MouseUp()Sub Form1_MouseUp(ByVal sender AsObject, ByVal e As System.Windows.Forms.MouseEventArgs) HandlesMyBase.MouseUp
MoveScreen =False End Sub
posted on
2005-04-12 00:57xyocj
阅读(434)
评论(0)
编辑收藏举报