04-04-14, 01:08 PM
كود :
Friend Class Form1
Inherits System.Windows.Forms.Form
Public Function RandomNum(ByRef Min As Object, ByRef Max As Object) As Integer
RandomNum = Int((Max - Min + 1) * Rnd() + Min)
End Function
Private Sub Command1_MouseMove(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.MouseEventArgs) Handles Command1.MouseMove
Dim Button As Short = eventArgs.Button \ &H100000
Dim Shift As Short = System.Windows.Forms.Control.ModifierKeys \ &H10000
Dim X As Single = VB6.PixelsToTwipsX(eventArgs.X)
Dim Y As Single = VB6.PixelsToTwipsY(eventArgs.Y)
Dim wh As Object
Dim ht As Object
ht = RandomNum(VB6.PixelsToTwipsY(Me.Top), VB6.PixelsToTwipsY(Me.Height))
wh = RandomNum(VB6.PixelsToTwipsX(Me.Left), VB6.PixelsToTwipsX(Me.Width))
Command1.SetBounds(VB6.TwipsToPixelsX(wh), VB6.TwipsToPixelsY(ht), 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
End Sub
End Class