تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
(تم الحل) تحريك الادوات
#1
السلام عليكم ورحمة الله وبركاته

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

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

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

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

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

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


الملفات المرفقة
.rar   MoveButton.rar (الحجم : 109.08 ك ب / التحميلات : 64)
}}}
تم الشكر بواسطة:
#4
السلام عليكم،
تم التعديل على الكود ليعمل كما تريد
الكود بعد التعديل:
كود :
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
}}}
تم الشكر بواسطة:
#5
نحمده ونصلي على رسوله الكريم


الملفات المرفقة
.zip   WindowsApplication1.zip (الحجم : 15.87 ك ب / التحميلات : 63)
}}}
تم الشكر بواسطة:
#6
اشكر الجميع على التعاون

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

وطبعاً ابعاد الاداة والتكست متساوية وضحت الفكرة
}}}
تم الشكر بواسطة:
#7
في مشروع الأخ 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
}}}
تم الشكر بواسطة:
#8
سلمت يداك هذا هو المطلوب
الف شكر
}}}
تم الشكر بواسطة:
#9
السلام عليكم ورحمة الله وبركاته

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

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

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

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

ولم ينفع
}}}
تم الشكر بواسطة:
#10
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)
}}}
تم الشكر بواسطة:


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  سؤال في تحريك التحديد في datagrideview maher_haddaf 3 439 23-10-23, 08:27 AM
آخر رد: أبو خالد الشكري
  البرنامج لدي يعمل على ويندوز 11 والان لا يعمل على ويندوز 10 ماهو الحل moh61 1 299 01-09-23, 04:38 AM
آخر رد: اسامه الهرماوي
  ممكن الحل masport tv 0 298 07-04-23, 11:36 AM
آخر رد: masport tv
  كود تحريك الادوات داخل الفورم مع حفظ الترتيب حماده ممدوح البحيرى 0 296 17-12-22, 02:11 PM
آخر رد: حماده ممدوح البحيرى
  مطلوب كود تكبير الفورم مع الحفاظ علي حجم ومكان الادوات عند التكبير والتصغير Mostafa201255411 1 749 12-12-22, 07:02 PM
آخر رد: Taha Okla
  ارجو ان لا تبخلو علينا با الحل ahmedbezia 3 469 06-12-22, 01:29 PM
آخر رد: ahmedbezia
  [سؤال] [تم الحل] انشاء المسارات وتمرير البارامترات لها وقت التشغيل سعود 7 1,221 03-09-22, 09:44 AM
آخر رد: Taha Okla
  مشكلة واجهتني كتير وزهقت منها فاللي عنده الحل ياريت يفيدني بيه ميدو الفنان 7 1,029 03-09-22, 03:33 AM
آخر رد: ميدو الفنان
  [سؤال] * تم الحل * التحكم بمخرجات السريال بورت واعادة تحويلها mohamedallams 1 432 30-08-22, 06:42 PM
آخر رد: mohamedallams
  [سؤال] * [تم الحل] * المحاولة الثانية و اللتي باءت بالفشل حول تقسيم ملف بشكل دقيق سعود 8 1,035 27-08-22, 07:41 AM
آخر رد: سعود

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم