public InputParametersControl(IList <InputParameter> inputParameters) { InitializeComponent(); _inputParameterEditors = new List <BaseEdit>(); _inputParameters = inputParameters; foreach (var inputParameter in inputParameters) { LayoutControlItem colItem = layoutControl.Root.AddItem(); colItem.Name = inputParameter.DisplayName; var inputParameterEditor = new CalcEdit(); _inputParameterEditors.Add(inputParameterEditor); inputParameterEditor.Name = inputParameter.Name; inputParameterEditor.Validating += onEditorValidating; inputParameterEditor.EditValueChanged += onInputParameterEditorEditValueChanged; if (inputParameter.Value != null) { inputParameterEditor.EditValue = inputParameter.Value; } inputParameterEditor.Properties.AllowNullInput = DefaultBoolean.False; if (!String.IsNullOrEmpty(inputParameter.Unit.Name)) { inputParameterEditor.Properties.EditMask = String.Format("{0} [{1}];-{0} [{1}]", _numberFormat, inputParameter.Unit.Name); } else { inputParameterEditor.Properties.EditMask = String.Format("{0};-{0}", _numberFormat); } inputParameterEditor.Properties.DisplayFormat.FormatString = inputParameterEditor.Properties.EditMask; inputParameterEditor.Properties.DisplayFormat.FormatType = FormatType.Custom; inputParameterEditor.Properties.NullValuePrompt = Captions.Importer.PleaseEnterData; inputParameterEditor.Properties.CloseUpKey = new KeyShortcut(Keys.Enter); inputParameterEditor.ToolTipController = new ToolTipController(); inputParameterEditor.SuperTip = new SuperToolTip(); inputParameterEditor.SuperTip.Items.AddTitle(inputParameter.DisplayName); if (!String.IsNullOrEmpty(inputParameter.Unit.Name)) { inputParameterEditor.SuperTip.Items.Add(String.Format("Please enter a value in {0} [{1}].", inputParameter.Unit.DisplayName, inputParameter.Unit.Name)); } else { inputParameterEditor.SuperTip.Items.Add("Please enter a value."); } if (inputParameter.MinValue != null || inputParameter.MaxValue != null) { var lowerBound = (inputParameter.MinValue == null) ? INFINITY_SIGN : (inputParameter.MinValueAllowed) ? "[" : "]"; var lowerValue = (inputParameter.MinValue == null) ? String.Empty : inputParameter.MinValue.ToString(); var upperValue = (inputParameter.MaxValue == null) ? String.Empty : inputParameter.MaxValue.ToString(); var upperBound = (inputParameter.MaxValue == null) ? INFINITY_SIGN : (inputParameter.MaxValueAllowed) ? "]" : "["; var text = String.Format("Valid values must be within range {0}{1};{2}{3}.", lowerBound, lowerValue, upperValue, upperBound); inputParameterEditor.SuperTip.Items.Add(text); } inputParameterEditor.ToolTipController.ToolTipType = ToolTipType.SuperTip; inputParameterEditor.PerformLayout(); colItem.Control = inputParameterEditor; checkEditorInput(inputParameterEditor); } }