private void StyleConfigControl_Load(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. panelSelectedColor.Visible = false; panelBrightness.Visible = false; panelColor.Visible = false; // Calculate the coordinates of the three // required regions on the form. Rectangle SelectedColorRectangle = new Rectangle(panelSelectedColor.Location, panelSelectedColor.Size); Rectangle BrightnessRectangle = new Rectangle(panelBrightness.Location, panelBrightness.Size); Rectangle ColorRectangle = new Rectangle(panelColor.Location, panelColor.Size); // Create the new ColorWheel class, indicating // the locations of the color wheel itself, the // brightness area, and the position of the selected color. myColorWheel = new ColorWheel( ColorRectangle, BrightnessRectangle, SelectedColorRectangle); myColorWheel.ColorChanged += new EventHandler <ColorChangedEventArgs>(myColorWheel_ColorChanged); // Set the RGB and HSV values // of the NumericUpDown controls. SetRGB(RGB); SetHSV(HSV); }
private void StyleConfigControl_Load(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. panelSelectedColor.Visible = false; panelBrightness.Visible = false; panelColor.Visible = false; // Calculate the coordinates of the three // required regions on the form. Rectangle SelectedColorRectangle = new Rectangle(panelSelectedColor.Location, panelSelectedColor.Size); Rectangle BrightnessRectangle = new Rectangle(panelBrightness.Location, panelBrightness.Size); Rectangle ColorRectangle = new Rectangle(panelColor.Location, panelColor.Size); // Create the new ColorWheel class, indicating // the locations of the color wheel itself, the // brightness area, and the position of the selected color. myColorWheel = new ColorWheel( ColorRectangle, BrightnessRectangle, SelectedColorRectangle); myColorWheel.ColorChanged += new EventHandler<ColorChangedEventArgs>(myColorWheel_ColorChanged); // Set the RGB and HSV values // of the NumericUpDown controls. SetRGB(RGB); SetHSV(HSV); }