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. Visual Basic
  4. LineShape Control MouseMove Problem at runtime like a control movement.

LineShape Control MouseMove Problem at runtime like a control movement.

Scheduled Pinned Locked Moved Visual Basic
csharpgraphicshelp
5 Posts 2 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.
  • F Offline
    F Offline
    for1206
    wrote on last edited by
    #1

    Hi CodeProject , The problem is I am drawing a LineShape control from Microsoft PowerPacks controls .dll , I am also moving the line when MouseDown,MouseMove,MouseUp, But i am not able to drag the line in the correct position like in VB.net 2005 MouseDown fdragging =true startx =0 starty =0 MouseMove m_control.StartPoint = New Point((m_control.StartPoint.X + e.X) - startx, (m_control.StartPoint.Y + e.Y) - starty) m_control.EndPoint = New Point((m_control.EndPoint.X + e.X - startx), (m_control.EndPoint.Y + e.Y - starty)) MouseUp fdragging = false & the things are i am not able to handle the MouseUp event also after mousemove the pointer is slipping from the line & not able move the line in the correct direction. Regards,

    For1206

    D 1 Reply Last reply
    0
    • F for1206

      Hi CodeProject , The problem is I am drawing a LineShape control from Microsoft PowerPacks controls .dll , I am also moving the line when MouseDown,MouseMove,MouseUp, But i am not able to drag the line in the correct position like in VB.net 2005 MouseDown fdragging =true startx =0 starty =0 MouseMove m_control.StartPoint = New Point((m_control.StartPoint.X + e.X) - startx, (m_control.StartPoint.Y + e.Y) - starty) m_control.EndPoint = New Point((m_control.EndPoint.X + e.X - startx), (m_control.EndPoint.Y + e.Y - starty)) MouseUp fdragging = false & the things are i am not able to handle the MouseUp event also after mousemove the pointer is slipping from the line & not able move the line in the correct direction. Regards,

      For1206

      D Offline
      D Offline
      DaveAuld
      wrote on last edited by
      #2

      On the mouse down, does the startx, starty not have to be the point relative to the main form position? Then on the mouse move, you use the move offsets to relocate the line relative to startx and starty.

      Dave Don't forget to rate messages!
      Find Me On: Web|Facebook|Twitter|LinkedIn
      Waving? dave.m.auld[at]googlewave.com

      F 1 Reply Last reply
      0
      • D DaveAuld

        On the mouse down, does the startx, starty not have to be the point relative to the main form position? Then on the mouse move, you use the move offsets to relocate the line relative to startx and starty.

        Dave Don't forget to rate messages!
        Find Me On: Web|Facebook|Twitter|LinkedIn
        Waving? dave.m.auld[at]googlewave.com

        F Offline
        F Offline
        for1206
        wrote on last edited by
        #3

        Hi Dave , I m using a split container.On Panel1 i created a panel and on that i am drawing the line .& trying to move on the MouseDown ,Move,Up for LineShape Controls. But i am not able to drag the line while placing the cursor at any position on the line due to the logic problem exactly & loosing the grip of the line while placing the mousepointer & dragging the line not firing the MouseUp . Regards,

        For1206

        D 1 Reply Last reply
        0
        • F for1206

          Hi Dave , I m using a split container.On Panel1 i created a panel and on that i am drawing the line .& trying to move on the MouseDown ,Move,Up for LineShape Controls. But i am not able to drag the line while placing the cursor at any position on the line due to the logic problem exactly & loosing the grip of the line while placing the mousepointer & dragging the line not firing the MouseUp . Regards,

          For1206

          D Offline
          D Offline
          DaveAuld
          wrote on last edited by
          #4

          See code below, i have just tried this and it is fine. Form, with SplitContainer, and A PowerPack Line in the right Panel

          Private \_lineDrag As Boolean = False
          Private \_x As Integer = 0
          Private \_y As Integer = 0
          
          Private Sub LineShape1\_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles LineShape1.MouseDown
          
              If e.Button = Windows.Forms.MouseButtons.Left Then
                  \_lineDrag = True
                  \_x = e.X
                  \_y = e.Y
          
              End If
          
          End Sub
          
          Private Sub LineShape1\_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles LineShape1.MouseMove
          
              If e.Button = Windows.Forms.MouseButtons.Left And \_lineDrag Then
          
                  LineShape1.X1 = (LineShape1.StartPoint.X + e.X) - \_x
                  LineShape1.X2 = (LineShape1.EndPoint.X + e.X) - \_x
          
                  LineShape1.Y1 = (LineShape1.StartPoint.Y + e.Y) - \_y
                  LineShape1.Y2 = (LineShape1.EndPoint.Y + e.Y) - \_y
          
                  Me.Refresh()
          
              End If
          
          End Sub
          
          Private Sub LineShape1\_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles LineShape1.MouseUp
          
              If e.Button = Windows.Forms.MouseButtons.Left Then
                  \_lineDrag = False
              End If
          
          End Sub
          

          Dave Don't forget to rate messages!
          Find Me On: Web|Facebook|Twitter|LinkedIn
          Waving? dave.m.auld[at]googlewave.com

          F 1 Reply Last reply
          0
          • D DaveAuld

            See code below, i have just tried this and it is fine. Form, with SplitContainer, and A PowerPack Line in the right Panel

            Private \_lineDrag As Boolean = False
            Private \_x As Integer = 0
            Private \_y As Integer = 0
            
            Private Sub LineShape1\_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles LineShape1.MouseDown
            
                If e.Button = Windows.Forms.MouseButtons.Left Then
                    \_lineDrag = True
                    \_x = e.X
                    \_y = e.Y
            
                End If
            
            End Sub
            
            Private Sub LineShape1\_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles LineShape1.MouseMove
            
                If e.Button = Windows.Forms.MouseButtons.Left And \_lineDrag Then
            
                    LineShape1.X1 = (LineShape1.StartPoint.X + e.X) - \_x
                    LineShape1.X2 = (LineShape1.EndPoint.X + e.X) - \_x
            
                    LineShape1.Y1 = (LineShape1.StartPoint.Y + e.Y) - \_y
                    LineShape1.Y2 = (LineShape1.EndPoint.Y + e.Y) - \_y
            
                    Me.Refresh()
            
                End If
            
            End Sub
            
            Private Sub LineShape1\_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles LineShape1.MouseUp
            
                If e.Button = Windows.Forms.MouseButtons.Left Then
                    \_lineDrag = False
                End If
            
            End Sub
            

            Dave Don't forget to rate messages!
            Find Me On: Web|Facebook|Twitter|LinkedIn
            Waving? dave.m.auld[at]googlewave.com

            F Offline
            F Offline
            for1206
            wrote on last edited by
            #5

            Hi Dave , Thanks its moving fine . 1) But my LineShape controls is slipping from the mouse pointer while moving . So not able to drag the line in a correct way ,Freely . 2) I am able to get the traces of line if resized on the Start point or End Point handles . & i have to refresh the Panel i.e., Parent of the Shapecontainer . My way of doing the things . SplitContainer -> Panel1 -> New Panel at runtime -- This Panel is parent for the shape controls . The Same problem also coming for RectangleShape & Oval Shape also. I have to press the mousebutton very forcefully & drag the control otherwise slipping from my mousepointer . What to do ??

            For1206

            modified on Friday, February 19, 2010 12:43 AM

            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