بسم الله الرحمن الرحيم
اريد المساعدة في الحصول على كود تحريك الصورة كما هو موضح في الصورة حصلت على الكود الخاص بالتكبير بقي كود
تحريك الصورة
كود التكبير ضعه في بوتون
PictureBox1.Width += 40%
PictureBox1.Height += 40%
بسم الله الرحمن الرحيم
اريد المساعدة في الحصول على كود تحريك الصورة كما هو موضح في الصورة حصلت على الكود الخاص بالتكبير بقي كود
تحريك الصورة
كود التكبير ضعه في بوتون
PictureBox1.Width += 40%
PictureBox1.Height += 40%
تم تعديل هذه المشاركة بواسطة محمد مسافر في 19 نوفمبر 2014 في 11:42
السلام عليكم
جرب الكود التالي
Dim TemporaryMousePointerLocation As Point Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove Static UpdateMouseOnNextMove As Boolean = False If DirectCast(e, MouseEventArgs).Button = MouseButtons.Right Then If UpdateMouseOnNextMove Then PictureBox1.Left -= (Windows.Forms.Cursor.Position.X - TemporaryMousePointerLocation.X) PictureBox1.Top -= (Windows.Forms.Cursor.Position.Y - TemporaryMousePointerLocation.Y) Windows.Forms.Cursor.Position = TemporaryMousePointerLocation UpdateMouseOnNextMove = False Else UpdateMouseOnNextMove = True ' allow cursor to move a bit so we can update the position of the mouse End If Else TemporaryMousePointerLocation = Windows.Forms.Cursor.Position End If End Sub
اداة تنسيق الكود لا تعمل بالشكل المطلوب .. فعذراً
تفضل اخي مثال و لكن بكود مختلف
بالتوفيق
وجدت الحل وشكراً للجميع ولمن ساعدني ولم يتجاهل موضوعي
Private Sub PictureBox_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
Static mousePosX As Single, mousePosY As Single
If e.Button = 0 Then
mousePosX = e.X
mousePosY = e.Y
Else
PictureBox1.Left = PictureBox1.Left + (e.X - mousePosX)
PictureBox1.Top = PictureBox1.Top + (e.Y - mousePosY)
End If
End Sub
وهذاء مشروع ممكن الاستفادة منة