This is a migrated thread and some comments may be shown as answers.

Drag&Drop: Get Drop-Location of Drop-Element

1 Answer 245 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 07 Jan 2020, 08:17 AM

Hello and a happy new Year!!!

I implement a drag&drop-function from RadPanels inside a System.Windows.Forms.FlowLayoutPanel.

When i come to the DragDrop-Event the "DragEventArgs e" only have the Location (e.X / e.Y) of the display not from the FlowLayoutPanel.

Where can i get the location of the dropped RadPanel?

Another question: Is there an event of moving the dragged RadPanel? I didnĀ“t found that. I need this for animation / show the dragged RadPanel.

Best regards, Martin

 

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 08 Jan 2020, 09:13 AM
Hello, Martin,   

To perform drag-and-drop operations within Windows-based applications you must handle a series of events, most notably the DragEnter, DragLeave, and DragDrop events. A sample approach is demonstrated in the following article: https://docs.microsoft.com/en-us/dotnet/framework/winforms/advanced/walkthrough-performing-a-drag-and-drop-operation-in-windows-forms 

The DragEventArgs offers the X,Y values in screen coordinates. You can calculate the drop location within the control's bounds by using the PointToClient method: 
        private void radPanel1_DragDrop(object sender, DragEventArgs e)
        {
            Point screenDropLocation = new Point(e.X, e.Y);
            Point dropLocation = this.radPanel1.PointToClient(screenDropLocation);
            Console.WriteLine("Screen drop location :" + screenDropLocation+ " Control drop location:" +dropLocation);
        }
There is no specific event for moving the dragged RadPanel. However, if you need to simulate animation effect, I would recommend you to have a look at the following help article which demonstrates the available options in the Telerik Presentation Framework: https://docs.telerik.com/devtools/winforms/telerik-presentation-framework/animations 

I hope this information helps. If you need any further assistance please don't hesitate to contact me.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
General Discussions
Asked by
Martin
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or