private void ColorChooser1_Load(object sender, System.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.
            pnlSelectedColor.Visible = false;
            pnlBrightness.Visible    = false;
            pnlColor.Visible         = false;

            // Calculate the coordinates of the three
            // required regions on the form.
            Rectangle SelectedColorRectangle =
                new Rectangle(pnlSelectedColor.Location, pnlSelectedColor.Size);
            Rectangle BrightnessRectangle =
                new Rectangle(pnlBrightness.Location, pnlBrightness.Size);
            Rectangle ColorRectangle =
                new Rectangle(pnlColor.Location, 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.
            myColorWheel = new ColorWheel(
                ColorRectangle, BrightnessRectangle,
                SelectedColorRectangle);
            myColorWheel.ColorChanged +=
                new ColorWheel.ColorChangedEventHandler(
                    this.myColorWheel_ColorChanged);

            // Set the RGB and HSV values
            // of the NumericUpDown controls.
            RefreshEditors();
        }
Ejemplo n.º 2
0
		private void ColorChooser1_Load(object sender, System.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.
			pnlSelectedColor.Visible = false;
			pnlBrightness.Visible = false;
			pnlColor.Visible = false;

			// Calculate the coordinates of the three
			// required regions on the form.
			Rectangle SelectedColorRectangle =
				new Rectangle(pnlSelectedColor.Location, pnlSelectedColor.Size);
			Rectangle BrightnessRectangle =
				new Rectangle(pnlBrightness.Location, pnlBrightness.Size);
			Rectangle ColorRectangle =
				new Rectangle(pnlColor.Location, 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.
			myColorWheel = new ColorWheel(
				ColorRectangle, BrightnessRectangle,
				SelectedColorRectangle);
			myColorWheel.ColorChanged +=
				new ColorWheel.ColorChangedEventHandler(
					this.myColorWheel_ColorChanged);

			// Set the RGB and HSV values 
			// of the NumericUpDown controls.
			RefreshEditors();
		}