منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب
تحريك الفورم بدون Api - نسخة قابلة للطباعة

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb)
+-- قسم : الأقسام التعليمية - المنتدى القديم (http://vb4arb.com/vb/forumdisplay.php?fid=90)
+--- قسم : مكتبة أكواد المنتدى (http://vb4arb.com/vb/forumdisplay.php?fid=111)
+---- قسم : مكتبة أكواد الفيجوال بيسك 6 (http://vb4arb.com/vb/forumdisplay.php?fid=116)
+---- الموضوع : تحريك الفورم بدون Api (/showthread.php?tid=6046)



تحريك الفورم بدون 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]
أرجو أن تعجبكم الأكواد