///<summary> ///Called when a drag-and-drop operation enters the control designer view. ///</summary> /// ///<param name="de">A <see cref="T:System.Windows.Forms.DragEventArgs"></see> that provides data for the event. </param> protected override void OnDragEnter(DragEventArgs de) { WizardControl control = (WizardControl)Control; if (control.WizardSteps.Count <= 0) { base.OnDragEnter(de); return; } WizardStep step = control.WizardSteps[control.CurrentStepIndex]; Point pt = step.PointToClient(new Point(de.X, de.Y)); Rectangle clientRectangle = step.ClientRectangle; if (!clientRectangle.Contains(pt)) { base.OnDragEnter(de); return; } GetWizardStepDesigner(step).OnDragEnterInternal(de); forwardOnDrag = true; }
///<summary> ///Called when a drag-and-drop object is dragged over the control designer view. ///</summary> /// ///<param name="de">A <see cref="T:System.Windows.Forms.DragEventArgs"></see> that provides data for the event. </param> protected override void OnDragOver(DragEventArgs de) { WizardControl control = Control as WizardControl; if (control == null || control.WizardSteps.Count <= 0) { de.Effect = DragDropEffects.None; return; } WizardStep step = control.WizardSteps[control.CurrentStepIndex]; Point pt = step.PointToClient(new Point(de.X, de.Y)); WizardStepDesigner wizardStepDesigner = GetWizardStepDesigner(step); Rectangle clientRectangle = step.ClientRectangle; if (!clientRectangle.Contains(pt)) { if (!forwardOnDrag) { de.Effect = DragDropEffects.None; return; } forwardOnDrag = false; wizardStepDesigner.OnDragLeaveInternal(EventArgs.Empty); base.OnDragEnter(de); return; } else { if (!forwardOnDrag) { base.OnDragLeave(EventArgs.Empty); wizardStepDesigner.OnDragEnterInternal(de); forwardOnDrag = true; return; } wizardStepDesigner.OnDragOverInternal(de); return; } }