示例#1
0
        public void ChangeColor(object obj, EventArgs ea)
        {
            PalletColor cb = (PalletColor)((RadioButton)obj).Tag;

            //Play bob saying the name of the color!
            if (cb.sfx != null)
            {
                cb.sfx.Position  = 0;
                sfxPlayer.Stream = cb.sfx;
                sfxPlayer.Play();
            }
            int alpha = penkleur.A;                                               //Save current alpha level

            penkleur = cb.color;                                                  //Set RGB values from pallet
            penkleur = Color.FromArgb(alpha, penkleur.R, penkleur.G, penkleur.B); //Apply saved alpha level to new pen color
        }
示例#2
0
        //When you choose one of the default colors this function is called to make sure the correct spot on the
        //Color wheel for that color is highlighted!
        private void UpdateWheelColorFromDefaults(object sender, EventArgs ea)
        {
            PalletColor pc = (PalletColor)((RadioButton)sender).Tag;;
            ColorPicker cp = this.Controls.Find("colorPicker", true).FirstOrDefault() as ColorPicker;

            cp.SetColor(pc.color);
            ColorConverter cc = new ColorConverter();

            double[] hsv = cc.Color2HSV(pc.color);
            cp.SetValue(hsv[2]);

            TrackBar tb = this.Controls.Find("ValueTrackBar", true).FirstOrDefault() as TrackBar;

            tb.Value = (int)Math.Round(hsv[2] * 100);
            tb.Invalidate();

            tb       = this.Controls.Find("SatTrackBar", true).FirstOrDefault() as TrackBar;
            tb.Value = (int)Math.Round(hsv[1] * 100);
            tb.Invalidate();

            tb       = this.Controls.Find("HueTrackBar", true).FirstOrDefault() as TrackBar;
            tb.Value = (int)Math.Round(hsv[0]);
            tb.Invalidate();
        }