private void EnsureDropDownIsCreated() { if (_dropDown == null) { _dropDown = new ToolStripColorPickerDropDown(); _dropDown.ColorChanged += this.DropDownColorChangedHandler; } }
/// <summary> /// Releases the unmanaged resources used by the <see cref="T:System.Windows.Forms.ToolStripDropDownItem"/> and optionally releases the managed resources. /// </summary> /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources. </param> protected override void Dispose(bool disposing) { if (disposing) { if (_dropDown != null) { this.DropDown = null; _dropDown.Dispose(); _dropDown.ColorChanged -= this.DropDownColorChangedHandler; _dropDown = null; } } base.Dispose(disposing); }