06-05-20, 07:25 AM
السلام عليكم اخوتي وتقبل الله صلاتكم و صيامكم
ارجوا كود لتحريك الادوات على الفورم اثناء التشغيل ...... وشكرا مسبقا ..
ارجوا كود لتحريك الادوات على الفورم اثناء التشغيل ...... وشكرا مسبقا ..
(06-05-20, 01:55 PM)nabil.1710 كتب : [ -> ]تفضل
PictureBox3.Top = PictureBox3.Top + 10
Private mouseDownLocation As Point
Private Sub PictureBox1_MouseDown(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseDown
If e.Button = System.Windows.Forms.MouseButtons.Left Then
mouseDownLocation = e.Location
End If
End Sub
Private Sub PictureBox1_MouseMove_1(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseMove
If e.Button = System.Windows.Forms.MouseButtons.Left Then
PictureBox1.Left = e.X + PictureBox1.Left - mouseDownLocation.X
PictureBox1.Top = e.Y + PictureBox1.Top - mouseDownLocation.Y
End If
End Sub(07-05-20, 03:25 AM)ابراهيم ايبو كتب : [ -> ]السلام عليكم ورحمة الله وبركاته
اخي الكريم يلزمك حدثين للاداة التي تريد تحريكها
1 حدث MouseDown
2- MouseMove
اولا نعرف متغير عبارة عن النقطة التي نضغط فيها بالماوس على الكونترول والباقي كما في الاكواد عمليات حسابية
هنا في هذه الاكواد ضع اداة pictureBox واستخدم الحدثين كالتالي
كود :
Private mouseDownLocation As Point
Private Sub PictureBox1_MouseDown(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseDown
If e.Button = System.Windows.Forms.MouseButtons.Left Then
mouseDownLocation = e.Location
End If
End Sub
Private Sub PictureBox1_MouseMove_1(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseMove
If e.Button = System.Windows.Forms.MouseButtons.Left Then
PictureBox1.Left = e.X + PictureBox1.Left - mouseDownLocation.X
PictureBox1.Top = e.Y + PictureBox1.Top - mouseDownLocation.Y
End If
End Sub
Private Sub pics()
Dim c As Control
Dim i As Integer = 1
For Each c In Panel1.Controls
i = c.Name.Replace("p", "")
If TypeOf c Is PictureBox Then
CType(c, PictureBox).ImageLocation = CurDir() & "\pics\forvb_" & i.ToString("00") & ".png"
End If
Next
End Sub
(07-05-20, 07:16 AM)سعود كتب : [ -> ]![]()
حبيت اشارك بالفكرة هذا فورم يحتوي 35 مربع صورة وكل مربع مربوط بصورة ضمن مجلدوالربط او الاسناد بالكودPHP كود :
Private Sub pics()
Dim c As Control
Dim i As Integer = 1
For Each c In Panel1.Controls
i = c.Name.Replace("p", "")
If TypeOf c Is PictureBox Then
CType(c, PictureBox).ImageLocation = CurDir() & "\pics\forvb_" & i.ToString("00") & ".png"
End If
Next
End Sub