I have a form which contains components that can be drag out my form to be on their own.
On the QueryContinueDrag event of my components, If the QueryContinueDragEventArgs.Action is Drop I test if my component is In the active form. If not, I create a new form and y put it in at the location of my cursor.
The problem is, the dragEffect indicates that I can't drop out the form. Is there any way I can change this?
Can't post much code here, cause it's way more complexe than just this. But if needed I'll try to do a simple project that show my issue.
According to Jimi:
You can change the Cursor while Dragging something.
Try this in QueryContinueDrag:
switch (e.Action)
{
case DragAction.Continue:
if (!this.Bounds.Contains(MousePosition))
Cursor.Current = Cursors.Help;
break;
case DragAction.Drop:
if (!this.Bounds.Contains(MousePosition))
{
// new Form
}
break;
}
You could do the same in GiveFeedback
, checking the Cursor position, and set e.UseDefaultCursors = false; Cursor.Current = Cursors.Help;
if the position falls outside the bounds, otherwise e.UseDefaultCursors = true;
.