14-01-14, 03:23 AM
هذا الكود يعمل مع تحريك الكوماند
كود :
Dim SSX As Integer
Dim SSY As Integer
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
Command1.Left = Command1.Left + X - SSX
Command1.Top = Command1.Top + Y - SSY
X = Command1.Left
Y = Command1.Top
Text1.Text = Command1.Height
Text2.Text = Command1.Width
Text3.Text = Command1.Top - Val(Text1.Text)
Text4.Text = Picture1.Top
If Picture1.Top = Command1.Top - Val(Text1.Text) And Picture1.Left = Command1.Left + Val(Text2.Text) Then
MsgBox "yes"
End If
If Picture1.Top = Command1.Top + Val(Text1.Text) And Picture1.Left = Command1.Left - Val(Text2.Text) Then
MsgBox "yes"
End If
If Picture1.Top = Command1.Top - Val(Text1.Text) And Picture1.Left = Command1.Left - Val(Text2.Text) Then
MsgBox "yes"
End If
If Picture1.Top = Command1.Top + Val(Text1.Text) And Picture1.Left = Command1.Left + Val(Text2.Text) Then
MsgBox "yes"
End If
If Command1.Top = Picture1.Top And Picture1.Left = Command1.Left + Val(Text2.Text) Then
MsgBox "yes"
End If
If Command1.Top = Picture1.Top And Picture1.Left = Command1.Left - Val(Text2.Text) Then
MsgBox "yes"
End If
If Picture1.Top = Command1.Top + Val(Text1.Text) And Command1.Left = Picture1.Left Then
MsgBox "yes"
End If
If Picture1.Top = Command1.Top - Val(Text1.Text) And Command1.Left = Picture1.Left Then
MsgBox "yes"
End If
End If
End Sub
