Is it possible to drag control from one form to another form in vb.net in visual studio 2012 using telerik controls ?

2 posts, 1 answers
  1. Aravind
    Aravind avatar
    41 posts
    Member since:
    Jun 2013

    Posted 20 Aug 2013 Link to this post

     Private blnMoving As Boolean = False
        Private MouseDownX As Integer
        Private MouseDownY As Integer
        Private MovingRect As Rectangle
        Private oldRect As Rectangle
        Private blnClick As Boolean = False
     
        Private Sub Button1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseDown
            If e.Button = MouseButtons.Left Then
                blnMoving = True
                MouseDownX = e.X
                MouseDownY = e.Y
                MovingRect = New Rectangle(Button1.Location, Button1.Size)
            End If
        End Sub
     
        Private Sub Button1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseUp
            If e.Button = MouseButtons.Left And Not blnClick Then
                Button1.Location = Me.PointToClient(New Point(MovingRect.X, MovingRect.Y))
                Me.Refresh()
                oldRect = oldRect.Empty
                blnMoving = False
            Else
                blnClick = False
                blnMoving = False
            End If
        End Sub
     
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            blnClick = True
        End Sub
     
        Private Sub Button1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseMove
            If blnMoving Then
                If Not oldRect.IsEmpty Then
                    ControlPaint.DrawReversibleFrame(MovingRect, Me.BackColor, FrameStyle.Thick)
                    Button1.Refresh()
                End If
     
                Dim temp As Point = Me.PointToScreen(New Point(Button1.Location.X + (e.X - MouseDownX), Button1.Location.Y + (e.Y - MouseDownY)))
     
                MovingRect.X = temp.X
                MovingRect.Y = temp.Y
     
                If Me.ClientRectangle.Contains(Me.RectangleToClient(MovingRect)) Then
                    oldRect = MovingRect
                Else
                    MovingRect = oldRect
                End If
                ControlPaint.DrawReversibleFrame(MovingRect, SystemColors.Control, FrameStyle.Thick)
            End If
        End Sub
    but my need is form main form if i click button it open one floating form and it contains controls,and form that folating form i need to click the control and drag and drop in main form.And also capture and save the location in form ,if i close application and open again i need to fix button in last time saved x and y axis location, so where i capture the x axis and y axis ? is it possible to capture x axis and y axis in sql server ?,and if i open again is possible to retrive data from sql server and give to controls ?
    Is it possible ?
     
    Regards
    Aravind
  2. Answer
    Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 23 Aug 2013 Link to this post

    Hi Aravind,

    Thank you for writing.

    I am afraid that this question is not related to any of our components in the Radcontrols for WinForms suite, hence it is out of the scope of our support services. I am certain that if you manage to achieve such functionality with the microsoft controls you will also be able to achieve it with ours. If you manage to do that and you experience any issues to accommodate the same approach to our controls, please let us know and we will gladly help you to implement it.

    Do not hesitate to contact us if you have other questions.

    Regards,
    Dimitar
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top