protected override void OnDragEnter(DragEventArgs e) { WizardStepDesigner stepDesigner = GetStepDesigner(); WizardStep currentStep = GetWizard().CurrentStep; // if the user drags something over the wizard step, begin forwarding the events to the step designer if(stepDesigner != null && currentStep.ClientRectangle.Contains(currentStep.PointToClient(new Point(e.X, e.Y)))) { forwardingDrag = true; stepDesigner.InternalOnDragEnter(e); } else { base.OnDragEnter(e); } }
///<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)this.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; } this.GetWizardStepDesigner(step).OnDragEnterInternal(de); this.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 = 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; } }