PDA

View Full Version : سوال: fromeBorderStyle



AghaMohsen
دوشنبه 13 تیر 1390, 22:02 عصر
اگر ما fromeBorderStyle رو روی none تنظیم کنیم ، دیگه نمیشه فروم رو در صفحه حرکت داد.
برای به حرکت در آوردن فرم باید چی کار کرد.
ممنون میشم جواب بدین .

mhmoein
سه شنبه 14 تیر 1390, 00:10 صبح
این کد خدمت شما

Class Form1
Private IsFormBeingDragged As Boolean = False
Private MouseDownX As Integer
Private MouseDownY As Integer

Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseDown

If e.Button = MouseButtons.Left Then
IsFormBeingDragged = True
MouseDownX = e.X
MouseDownY = e.Y
End If
End Sub

Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseUp

If e.Button = MouseButtons.Left Then
IsFormBeingDragged = False
End If
End Sub

Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseMove

If IsFormBeingDragged Then
Dim temp As Point = New Point()

temp.X = Me.Location.X + (e.X - MouseDownX)
temp.Y = Me.Location.Y + (e.Y - MouseDownY)
Me.Location = temp
temp = Nothing
End If
End Sub
End Class

AghaMohsen
سه شنبه 14 تیر 1390, 10:20 صبح
دست درد نکنه .

خیلی مردی