How to move picturebox along with cursor movements
-
Hi all guys, I am building one eFlowchart whose work is similar to normal paper flowchart.There are lots of picturebox ctrl on eFlowchart.I hav to allow author to connect all picturebox with its connector. But main problem is how to move picturebox smoothly with mouse cursor.I am using mouse_down and mouse_move event. I have taken click coordinates in mouse_down event with e.x and e.y and then making plus-minus in mouse_move event, but still I am getting slight a bit roughness in ctrl movements.ctrl in design time in visual studios are very smooth,I wanna that type of smoothness. Pls help Thank you guys.
Regards Chintan www.visharadsoft.com (I am thinking to change humans to computer, but unfortunately GOD will not give me the source code)
-
Hi all guys, I am building one eFlowchart whose work is similar to normal paper flowchart.There are lots of picturebox ctrl on eFlowchart.I hav to allow author to connect all picturebox with its connector. But main problem is how to move picturebox smoothly with mouse cursor.I am using mouse_down and mouse_move event. I have taken click coordinates in mouse_down event with e.x and e.y and then making plus-minus in mouse_move event, but still I am getting slight a bit roughness in ctrl movements.ctrl in design time in visual studios are very smooth,I wanna that type of smoothness. Pls help Thank you guys.
Regards Chintan www.visharadsoft.com (I am thinking to change humans to computer, but unfortunately GOD will not give me the source code)
Hi Chintan, Here is ur soln~:laugh::laugh: Delcare these varibale as private 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 Good luck :cool::cool: Let me know when done !!!! ;)
Happy Programming ----- Abhijit
-
Hi Chintan, Here is ur soln~:laugh::laugh: Delcare these varibale as private 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 Good luck :cool::cool: Let me know when done !!!! ;)
Happy Programming ----- Abhijit
Hi abhijit Ya, you are correct tht I had already posted the question and also got the solution frm u,but all this I had programmed for child picture boxes 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. 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)