Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Problem with moving picturebox with Cursor on Mouse_Move event.

Problem with moving picturebox with Cursor on Mouse_Move event.

Scheduled Pinned Locked Moved C#
helpcomannouncement
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Chintan Desai
    wrote on last edited by
    #1

    Hi buddies, There are lots of small size picturebox on one picturebox control says picMain.At a time, I am moving only 1 picture on picMain on Mouse_Move event. But,I see problem with moving picture. Moving picture gets blur or I can say It need some re-draw. so,I have use Invalidate() and update() to make the solutions but not getting any solution. Instead of picMain if I try same thing on form, then it work very smoothly.I think picture box take more time to re-draw compare to form. Pls help !!!:confused:

    Regards Chintan www.visharadsoft.com (I am thinking to change humans to computer, but unfortunately GOD will not give me the source code)

    C A 2 Replies Last reply
    0
    • C Chintan Desai

      Hi buddies, There are lots of small size picturebox on one picturebox control says picMain.At a time, I am moving only 1 picture on picMain on Mouse_Move event. But,I see problem with moving picture. Moving picture gets blur or I can say It need some re-draw. so,I have use Invalidate() and update() to make the solutions but not getting any solution. Instead of picMain if I try same thing on form, then it work very smoothly.I think picture box take more time to re-draw compare to form. Pls help !!!:confused:

      Regards Chintan www.visharadsoft.com (I am thinking to change humans to computer, but unfortunately GOD will not give me the source code)

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      I'm not sure what help you need. You've worked out the answer I would give, don't use pictureboxes, pretty much ever. Just draw the image yourself.

      Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      C 1 Reply Last reply
      0
      • C Chintan Desai

        Hi buddies, There are lots of small size picturebox on one picturebox control says picMain.At a time, I am moving only 1 picture on picMain on Mouse_Move event. But,I see problem with moving picture. Moving picture gets blur or I can say It need some re-draw. so,I have use Invalidate() and update() to make the solutions but not getting any solution. Instead of picMain if I try same thing on form, then it work very smoothly.I think picture box take more time to re-draw compare to form. Pls help !!!:confused:

        Regards Chintan www.visharadsoft.com (I am thinking to change humans to computer, but unfortunately GOD will not give me the source code)

        A Offline
        A Offline
        Abhijit Jana
        wrote on last edited by
        #3

        You have alredy post that question, a few day ago...... if i am not wrong.... Your Same Post.....[^] and my answer was... Private dragging As Boolean Private beginX, beginY As Integer Private Sub PictureBox1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown dragging = True beginX = e.X beginY = e.Y End Sub Private Sub PictureBox1_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseUp dragging = False End Sub Private Sub PictureBox1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove If dragging = True Then PictureBox1.Location = New Point(PictureBox1.Location.X + e.X - beginX, PictureBox1.Location.Y + e.Y - beginY) Me.Refresh() End If End Sub :laugh::laugh:

        Best Regards ----------------- Abhijit Jana View My CodeProject Articles "Success is Journey it's not a destination"

        1 Reply Last reply
        0
        • C Christian Graus

          I'm not sure what help you need. You've worked out the answer I would give, don't use pictureboxes, pretty much ever. Just draw the image yourself.

          Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

          C Offline
          C Offline
          Chintan Desai
          wrote on last edited by
          #4

          Hi Mr Graus. My work is working fine only when child picture boxes are on form control, but now as my requirement got change, I have to move every child picturebox on picture box ctrl ( instead of form control ). When i move the child picturebox on picture control from xy1 location to xy2 location then picture looks like blur ( it seems that its own ghost is following at each mouse_move event).I am not getting the smotheness in dragging just as we get in Visual studio in design time during dragging ctrl from toolbox. pls reply thx

          Regards Chintan www.visharadsoft.com (I am thinking to change humans to computer, but unfortunately GOD will not give me the source code)

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups