///<summary> ///Called when a drag-and-drop operation leaves the control designer view. ///</summary> /// ///<param name="e">An <see cref="T:System.EventArgs"></see> that provides data for the event. </param> protected override void OnDragLeave(EventArgs e) { if (this.forwardOnDrag) { this.forwardOnDrag = false; WizardStepDesigner currentWizardStepDesigner = this.GetDesigner(); if (currentWizardStepDesigner == null) { return; } currentWizardStepDesigner.OnDragLeaveInternal(e); return; } base.OnDragLeave(e); }
///<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 = this.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 = this.GetWizardStepDesigner(step); Rectangle clientRectangle = step.ClientRectangle; if (!clientRectangle.Contains(pt)) { if (!this.forwardOnDrag) { de.Effect = DragDropEffects.None; return; } this.forwardOnDrag = false; wizardStepDesigner.OnDragLeaveInternal(EventArgs.Empty); base.OnDragEnter(de); return; } else { if (!this.forwardOnDrag) { base.OnDragLeave(EventArgs.Empty); wizardStepDesigner.OnDragEnterInternal(de); this.forwardOnDrag = true; return; } wizardStepDesigner.OnDragOverInternal(de); return; } }