تحريك الفورم بدون Api - RaggiTech - 17-10-12
كاتب الموضوع : sniperser
كود بسيط ل تحريك الفورم من أي نقطة بدون دالة API
كود :
Dim X1 As Double
Dim Y1 As Double
كود :
[b][FONT=Arial][SIZE=3]Private Sub Form_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
X1 = X
Y1 = Y
End Sub[/SIZE][/FONT][/b]
[b][FONT=Arial][SIZE=3]Private Sub Form_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)[/SIZE][/FONT][/b]
[b][FONT=Arial][SIZE=3]If Button = 0 Then
X1 = X
Y1 = Y
End If[/SIZE][/FONT][/b]
[b][FONT=Arial][SIZE=3]If Button = 1 Then
Call Form1.Move(Left - (X1 - X), Top - (Y1 - Y))
End If
End Sub
[/SIZE][/FONT][/b]
تحريك زر عند السحب والإفلات
كود :
[b][FONT=Arial][SIZE=3]
Private Sub Command1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
X1 = X
Y1 = Y
End Sub
Private Sub Command1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If Button = 0 Then
X1 = X
Y1 = Y
End If
If Button = 1 Then
Call Command1.Move(Command1.Left - (X1 - X), Command1.Top - (Y1 - Y))
End If
End Sub
[/SIZE][/FONT][/b]
كود :
Dim X1 As Double
Dim Y1 As Double
Private Sub Label1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
X1 = X
Y1 = Y
End Sub
Private Sub Label1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If Button = 0 Then
X1 = X
Y1 = Y
End If
If Button = 1 Then
Call Form1.Move(Left - (X1 - X), Top - (Y1 - Y))
End If
End Sub
تحريك فورم بواسطة ليبل
كود :
[/SIZE][/FONT][/b]Dim X1 As Double
Dim Y1 As Double
Private Sub Label1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
X1 = X
Y1 = Y
End Sub
Private Sub Label1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If Button = 0 Then
X1 = X
Y1 = Y
End If
If Button = 1 Then
Call Form1.Move(Left - (X1 - X), Top - (Y1 - Y))
End If
End Sub
[b][FONT=Arial][SIZE=3]
أرجو أن تعجبكم الأكواد
|