protected override void Dispose(bool disposing) { if (disposing) { // Be sure to unhook event handlers // to prevent "lapsed listener" leaks. nullValueButton.Click -= nullValueButton_Click; _enclosingInstance = null; nullValueButton.Dispose(); basePane.Controls.Clear(); basePane.Dispose(); } }
/// <summary> /// Creates a <strong>DropDownEditorControl</strong>. /// </summary> public DropDownEditorControl(NullableUITypeEditor enclosingInstance, Control control) { currentControl = null; _enclosingInstance = enclosingInstance; Visible = false; basePane = new FlowLayoutPanel(); basePane.BackColor = control.BackColor; Controls.Add(basePane); nullValueButton = new Button(); //todo: make this configurable nullValueButton.Text = enclosingInstance.i18NFactory.GetString(null, "OptionHandlerI18N_NO_VALUE"); basePane.Controls.Add(nullValueButton); nullValueButton.Click += nullValueButton_Click; this.Component = control; nullValueButton.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; basePane.Dock = DockStyle.Fill; }