override public void HandleDrop(DragEventArgs e, SuperListDragButton otherButton, SuperListDragButton thisButton) { FunctorEditor ctrlMove = otherButton.Tag as FunctorEditor; FunctorEditor ctrlTarget = thisButton.Tag as FunctorEditor; if (e.Effect == DragDropEffects.Move) { if (ctrlMove.LogicalHost == ctrlTarget.LogicalHost && ctrlMove.Parent == ctrlTarget.Parent) { this.OnReOrderRequest(otherButton, thisButton); } else if (ctrlMove.LogicalHost.GetType() == ctrlTarget.LogicalHost.GetType()) { SuperList senderParent = otherButton.GetParentList(); senderParent.OnTransferRequest(this, otherButton); //return DragDropEffects.Move; } else { MessageBox.Show("asdf"); } } else if (e.Effect == DragDropEffects.Copy) { if (ctrlMove.LogicalHost.GetType() == ctrlTarget.LogicalHost.GetType()) { SuperList senderParent = otherButton.GetParentList(); senderParent.OnCopyRequest(this, otherButton); //return DragDropEffects.Move; } } }
override public DragDropEffects ValidateDragTarget(Control toMove, Control target, DragEventArgs e) { FunctorEditor ctrlMove = toMove.Tag as FunctorEditor; FunctorEditor ctrlTarget = target.Tag as FunctorEditor; SuperList targetList = target as SuperList; //to empty list if (targetList != null) { SuperListDragButton button = toMove as SuperListDragButton; if (targetList.GetType() == button.GetParentList().GetType()) { if ((e.KeyState & 8) == 8 && (e.AllowedEffect & DragDropEffects.Copy) == DragDropEffects.Copy) { return(DragDropEffects.Copy); } else { return(DragDropEffects.Move); } } } if (ctrlMove == null || ctrlTarget == null) { return(DragDropEffects.None); } if ((e.KeyState & 8) == 8 && (e.AllowedEffect & DragDropEffects.Copy) == DragDropEffects.Copy) { return(DragDropEffects.Copy); } else if ((e.AllowedEffect & DragDropEffects.Move) == DragDropEffects.Move) { if (ctrlMove.LogicalHost == ctrlTarget.LogicalHost) { return(DragDropEffects.Move); } else if (ctrlMove.LogicalHost.GetType() == ctrlTarget.LogicalHost.GetType()) { return(DragDropEffects.Move); } } return(DragDropEffects.None); }
override public void HandleDrop(DragEventArgs e, SuperListDragButton otherButton, SuperListDragButton thisButton) { PropertyFlowList ctrlMove = otherButton.Tag as PropertyFlowList; PropertyFlowList ctrlTarget = thisButton.Tag as PropertyFlowList; if (e.Effect == DragDropEffects.Move) { //if (ctrlMove.SelectedObject == ctrlTarget.SelectedObject) if (ctrlMove.Parent == ctrlTarget.Parent) { this.OnReOrderRequest(otherButton, thisButton); } else if (ctrlMove.SelectedObject.GetType() == ctrlTarget.SelectedObject.GetType()) { SuperList senderParent = otherButton.GetParentList(); senderParent.OnTransferRequest(this, otherButton); //return DragDropEffects.Move; } } }
void SuperList_DragDrop(object sender, DragEventArgs e) { if (mControls.Count == 0) { if (e.Data.GetDataPresent(typeof(SuperListDragButton))) { object data = e.Data.GetData(typeof(SuperListDragButton)); SuperListDragButton otherButton = data as SuperListDragButton; if (otherButton != null) { SuperList senderParent = otherButton.GetParentList(); if (e.Effect == DragDropEffects.Move) { senderParent.OnTransferRequest(this, otherButton); } else if (e.Effect == DragDropEffects.Copy) { senderParent.OnCopyRequest(this, otherButton); } } } } }