/// <summary> /// Overloaded. Releases the resources used by the Component. /// </summary> protected override void Dispose(bool disposing) { if (disposing) { if (components != null) { components.Dispose(); } } base.Dispose(disposing); if (null != popup) { popup.Dispose(); popup = null; } }
/// <summary> /// Display the ColorPicker's drop down palette. /// </summary> public void ShowDropdown() { Point p = new Point(this.Left, this.Bottom); Point q = this.Parent.PointToScreen(p); if (null == popup) { popup = new ColorPanelForm(); popup.Top = q.Y; popup.Left = q.X; popup.ColorSet = panel_colorSet; popup.ColorSortOrder = panel_colorSortOrder; popup.ColorWellSize = panel_colorWellSize; popup.PanelBorderStyle = panel_PanelBorderStyle; popup.Columns = panel_columns; popup.CustomColors = panel_customColors; // set color after colorSet since changing the colorSet // resets the color to black popup.Color = panel_color; if (panel_columns <= 0) { Trace.WriteLine(string.Format("Setting '{0}' width = {1}", popup.Name, this.Width)); popup.ParentWidth = Width; } } if (DialogResult.OK == popup.ShowDialog(this)) { panel_color = popup.Color; OnColorChanged(new ColorChangedEventArgs(panel_color)); } popup.Dispose(); popup = null; }