/// <summary>Called when the Finish button is clicked. If the event is not canceled and the parent control is a form, /// the form will be closed with <see cref="DialogResult.OK"/>. /// </summary> protected virtual void OnFinishButtonClicked(CancelEventArgs e) { if(CurrentStepIndex != -1) CurrentStep.OnFinishButtonClicked(e); if(FinishButtonClicked != null) FinishButtonClicked(this, e); if(!e.Cancel && !DesignMode) // don't close the form in design mode { Form form = Parent as Form; if(form != null) { form.DialogResult = DialogResult.OK; if(!form.Modal) form.Close(); } } }