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

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb)
+-- قسم : قسم لغة الفيجوال بيسك VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=182)
+--- قسم : قسم مكتبة اكواد VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=185)
+--- الموضوع : كود الزر المتحرك (/showthread.php?tid=2456)



كود الزر المتحرك - جاسم عبد - 04-04-14

كود :
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
[/align]