public WizardControl() { SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.OptimizedDoubleBuffer, true); SetStyle(ControlStyles.ResizeRedraw, true); SetStyle(ControlStyles.UserPaint, true); finishButtonText = DefaultFinishButtonText; nextButtonText = DefaultNextButtonText; InitializeComponent(); wizardStepCollection = new WizardStepCollection(this); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { WizardStepCollection steps = (WizardStepCollection)value; WizardControl owner = steps.Owner; IDesignerHost container = (IDesignerHost)context.Container; int count = steps.Count; object obj2 = base.EditValue(context, provider, value); if (steps.Count >= count) { return(obj2); } SelectWizard(owner, container); return(obj2); }
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { WizardStepCollection steps = (WizardStepCollection)value; if (steps.Count != 0) { if (steps.Count != 1) { return(steps.Count + " steps"); } return("1 step"); } else { return("Empty"); } }
private void OnListBoxSelectedIndexChanged(object sender, EventArgs args) { ListBox box = sender as ListBox; if (box == null) { return; } IServiceProvider provider = (IServiceProvider)((object[])box.Tag)[1]; WizardStepCollection steps = (WizardStepCollection)((object[])box.Tag)[2]; IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (service == null) { return; } steps.Owner.CurrentStepIndex = box.SelectedIndex; service.CloseDropDown(); box.Dispose(); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (service == null) { return(value); } WizardStepCollection steps = (WizardStepCollection)value; ListBox control = new ListBox(); control.Tag = new object[] { context, provider, value }; control.Dock = DockStyle.Fill; control.HorizontalScrollbar = true; control.SelectedIndexChanged += new EventHandler(OnListBoxSelectedIndexChanged); for (int i = 0; i < steps.Count; i++) { control.Items.Add(steps[i].Name); } return(value); }
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { WizardStepCollection steps = (WizardStepCollection)value; return(steps[steps.Owner.CurrentStepIndex].ToString()); }