Search code examples
c#winformsgroupbox

Drag n drop in groupbox items


I am working on a Windows Forms project using C# where I use a groupbox as a container and add items to it (Labels, pictureBoxes...). I would like to know if is it possible to implement a drag and drop event on this control to move the items using the mouse or if I have to implement this event in the controls I add to my groupBox.


Solution

  • after some research about my topic, i found the solution with a help from a friend of mine. To do this task, we need to use some variables, properties and three mouse events to assign to the objects: MouseMove, MouseUp and MouseDown. I also found an example recently: http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/6eb864ff-0ea8-4641-bc2a-83db94371429