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

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

الصفحات: 1 2


(تم الحل) تحريك الادوات - aftfm - 13-11-12

السلام عليكم ورحمة الله وبركاته

هل هناك طريقة لتحريك الادوات

بحيث الضغط على اداة Label ووضعها على اداة Textbox وتجذبها اداة الـ TextBox كلمغنطيس

مع امكانية تحريكها مرة ثانية من فوق الاداة


(تم الحل) تحريك الادوات - سعود - 13-11-12

كل شي ممكن مع فيجوال بيسك
انت اعرف مكان اي اداة وقم بالتحكم بها من خلال مؤقت او bgw
[h=1]مثال التنقل بين صناديق المجموعات ضمن اداة بانل (وكل عام وانتم بخير - اخوكم سعود)[/h]


(تم الحل) تحريك الادوات - aftfm - 14-11-12

الف شكر اخي العزيز سعود

لكني لم اقصد هذا بل قصدت عند الضغط على نفس الاداة وتحريكها فوق اداة اخرى

وضعت مثال لذلك
لكن المثال عملته بطريقة اخرى لعدم تمكني من عمل ما اريد
اريد عند تحريك اداة Button فوق اداة TextBox بمجرد دخول اداة Button فوق اداة Textbox يتم وضع
اداة الـ Button فوق اداة Textbox حسب الـ Location لاداة TextBox

شاهد المثال وستعرف قصدي
المثال اضغط على اداة الـ Button سيتغير لونه ثم اضغط على احد مربعات النصوص وشاهد سينتقل الـ Button فوقه مباشرة
لكني اريده بالضغط والافلات فوق التكست بوكس


(تم الحل) تحريك الادوات - Aly El-Haddad - 14-11-12

السلام عليكم،
تم التعديل على الكود ليعمل كما تريد
الكود بعد التعديل:
كود :
Public Class Form1
    Public Const WM_NCLBUTTONDOWN = &HA1
    Public Const HTCAPTION = 2

    Private Sub Button1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseDown
        If e.Button = Windows.Forms.MouseButtons.Left Then
            Button1.Capture = False
            Dim msg As Message = _
                Message.Create(Button1.Handle, WM_NCLBUTTONDOWN, _
                    New IntPtr(HTCAPTION), IntPtr.Zero)
            Me.DefWndProc(msg)
        End If
        Me.Button1.BackColor = Color.Violet
    End Sub

    Private Sub Button2_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button2.MouseDown
        If e.Button = Windows.Forms.MouseButtons.Left Then
            Button2.Capture = False
            Dim msg As Message = _
                Message.Create(Button2.Handle, WM_NCLBUTTONDOWN, _
                    New IntPtr(HTCAPTION), IntPtr.Zero)
            Me.DefWndProc(msg)
        End If

        Me.Button2.BackColor = Color.Violet

    End Sub

    Private Sub Button3_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button3.MouseDown
        If e.Button = Windows.Forms.MouseButtons.Left Then
            Button3.Capture = False
            Dim msg As Message = _
                Message.Create(Button3.Handle, WM_NCLBUTTONDOWN, _
                    New IntPtr(HTCAPTION), IntPtr.Zero)
            Me.DefWndProc(msg)
        End If

        Me.Button3.BackColor = Color.Violet

    End Sub

    Private Sub Button4_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button4.MouseDown
        If e.Button = Windows.Forms.MouseButtons.Left Then
            Button4.Capture = False
            Dim msg As Message = _
                Message.Create(Button4.Handle, WM_NCLBUTTONDOWN, _
                    New IntPtr(HTCAPTION), IntPtr.Zero)
            Me.DefWndProc(msg)
        End If

        Me.Button4.BackColor = Color.Violet

    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

        Me.Button1.Location = New System.Drawing.Point(149, 66)
        Me.Button2.Location = New System.Drawing.Point(12, 66)
        Me.Button3.Location = New System.Drawing.Point(12, 24)
        Me.Button4.Location = New System.Drawing.Point(149, 24)

        Me.Button1.BackColor = Color.Empty
        Me.Button2.BackColor = Color.Empty
        Me.Button3.BackColor = Color.Empty
        Me.Button4.BackColor = Color.Empty

    End Sub

    Private Sub TextBox2_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TextBox2.MouseDown
        If Me.Button1.BackColor = Color.Violet Then
            Me.Button1.Location = New System.Drawing.Point(12, 132)
            If Me.Button1.Location = New System.Drawing.Point(12, 132) Then
                Me.Button1.BackColor = Color.Empty
                MsgBox("صح")
                TextBox2.Location = New Point(Button1.Left, Button1.Top - Button1.Height)
            End If
        End If
        If Me.Button2.BackColor = Color.Violet Then
            Me.Button2.Location = New System.Drawing.Point(12, 132)
            If Me.Button2.Location = New System.Drawing.Point(12, 132) Then
                Me.Button2.BackColor = Color.Empty
                MsgBox("خطأ")
                TextBox2.Location = New Point(Button2.Left, Button2.Top - Button2.Height)
            End If
        End If
        If Me.Button3.BackColor = Color.Violet Then
            Me.Button3.Location = New System.Drawing.Point(12, 132)
            If Me.Button3.Location = New System.Drawing.Point(12, 132) Then
                Me.Button3.BackColor = Color.Empty
                MsgBox("خطأ")
                TextBox2.Location = New Point(Button3.Left, Button3.Top - Button3.Height)
            End If
        End If
        If Me.Button4.BackColor = Color.Violet Then
            Me.Button4.Location = New System.Drawing.Point(12, 132)
            If Me.Button4.Location = New System.Drawing.Point(12, 132) Then
                Me.Button4.BackColor = Color.Empty
                MsgBox("خطأ")
                TextBox2.Location = New Point(Button4.Left, Button4.Top - Button4.Height)
            End If
        End If
    End Sub

    Private Sub TextBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseDown
        If Me.Button1.BackColor = Color.Violet Then
            Me.Button1.Location = New System.Drawing.Point(149, 132)
            If Me.Button1.Location = New System.Drawing.Point(149, 132) Then
                Me.Button1.BackColor = Color.Empty
                MsgBox("خطأ")
                TextBox1.Location = New Point(Button1.Left, Button1.Top - Button1.Height)
            End If
        End If
        If Me.Button2.BackColor = Color.Violet Then
            Me.Button2.Location = New System.Drawing.Point(149, 132)
            If Me.Button2.Location = New System.Drawing.Point(149, 132) Then
                Me.Button2.BackColor = Color.Empty
                MsgBox("صح")
                TextBox1.Location = New Point(Button2.Left, Button2.Top - Button2.Height)
            End If
        End If
        If Me.Button3.BackColor = Color.Violet Then
            Me.Button3.Location = New System.Drawing.Point(149, 132)
            If Me.Button3.Location = New System.Drawing.Point(149, 132) Then
                Me.Button3.BackColor = Color.Empty
                MsgBox("خطأ")
                TextBox1.Location = New Point(Button3.Left, Button3.Top - Button3.Height)
            End If
        End If
        If Me.Button4.BackColor = Color.Violet Then
            Me.Button4.Location = New System.Drawing.Point(149, 132)
            If Me.Button4.Location = New System.Drawing.Point(149, 132) Then
                Me.Button4.BackColor = Color.Empty
                MsgBox("خطأ")
                TextBox1.Location = New Point(Button4.Left, Button4.Top - Button4.Height)
            End If
        End If
    End Sub
End Class



(تم الحل) تحريك الادوات - ربيع - 14-11-12

نحمده ونصلي على رسوله الكريم


(تم الحل) تحريك الادوات - aftfm - 15-11-12

اشكر الجميع على التعاون

لكن ليس هذا ما قصدت تحريك الاداه هذا جميل جداً لكن اريد بعد تحريك الاداة من خلال
السحب ومرورها فوق التكست بمجرد دخولها فوق التكست والافلات يتم لصق الاداة فوق التكست

وطبعاً ابعاد الاداة والتكست متساوية وضحت الفكرة


(تم الحل) تحريك الادوات - Osama_Ghareeb - 15-11-12

في مشروع الأخ DreamsDotNet إستبدل الأمر الموجود في Button1_MouseUp بالأمر التالي :
كود :
Private Sub Button1_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseUp
        Button1.Cursor = Cursors.Default
        Dim P As Point = (Button1.Location + e.Location)
        If P.X >= TextBox1.Left AndAlso P.X <= TextBox1.Left + TextBox1.Width Then
            If P.Y >= TextBox1.Top AndAlso P.Y <= TextBox1.Top + TextBox1.Height Then
                TextBox1.Controls.Add(Button1)
                Button1.Dock = DockStyle.Fill
            End If
        End If
    End Sub



(تم الحل) تحريك الادوات - aftfm - 15-11-12

سلمت يداك هذا هو المطلوب
الف شكر


(تم الحل) تحريك الادوات - aftfm - 16-11-12

السلام عليكم ورحمة الله وبركاته

في طلب آخر متعلق بالموضوع بعد وضع الـ Button على TextBox

اريد اخرجه لا استطيع سحبه من فوق الـ TextBox

مع اني استخدمت في Button2 آخر

PHP كود :
Me.Button1.Location = New System.Drawing.Point(139310

ولم ينفع


(تم الحل) تحريك الادوات - Osama_Ghareeb - 17-11-12

aftfm كتب :السلام عليكم ورحمة الله وبركاته

في طلب آخر متعلق بالموضوع بعد وضع الـ Button على TextBox

اريد اخرجه لا استطيع سحبه من فوق الـ TextBox

مع اني استخدمت في Button2 آخر

PHP كود :
Me.Button1.Location = New System.Drawing.Point(139310

ولم ينفع

أضف في البداية الأمر التالي :
كود :
Button1.Dock = DockStyle.None
Me.Controls.Add(Button1)
  Me.Button1.Location = New System.Drawing.Point(139, 310)