/// <summary> /// The dispose. /// </summary> /// <param name="disposing"> /// The disposing. /// </param> protected override void Dispose(bool disposing) { if (disposing) { base.Dispose(true); if (this.myColorWheel != null) { this.myColorWheel.Dispose(); this.myColorWheel = null; } } }
/// <summary> /// The color chooser load. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> private void ColorChooserLoad(object sender, EventArgs e) { // Turn on double-buffering, so the form looks better. this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.DoubleBuffer, true); // These properties are set in design view, as well, but they // have to be set to false in order for the Paint // event to be able to display their contents. // Never hurts to make sure they're invisible. this.pnlSelectedColor.Visible = false; this.pnlBrightness.Visible = false; this.pnlColor.Visible = false; // Calculate the coordinates of the three // required regions on the form. Rectangle selectedColorRectangle = new Rectangle(this.pnlSelectedColor.Location, this.pnlSelectedColor.Size); Rectangle brightnessRectangle = new Rectangle(this.pnlBrightness.Location, this.pnlBrightness.Size); Rectangle colorRectangle = new Rectangle(this.pnlColor.Location, this.pnlColor.Size); // Create the new ColorWheel class, indicating // the locations of the color wheel itself, the // brightness area, and the position of the selected color. this.myColorWheel = new ColorWheel(colorRectangle, brightnessRectangle, selectedColorRectangle); this.myColorWheel.ColorChanged += this.MyColorWheelColorChanged; // Set the RGB and HSV values // of the NumericUpDown controls. this.SetRGB(this.argb); this.SetHSV(this.hsv); }
protected override void Dispose(bool disposing) { if (disposing) { base.Dispose(disposing); if (myColorWheel != null) { myColorWheel.Dispose(); myColorWheel = null; } } }