public Form1() { InitializeComponent(); lblBinLeft.Hide(); lblBinRight.Hide(); r = new Random(); Cauldren.BackColor = new HSVColor(r.Next(255), satuationVal, ValueVal).RgbColor; Color c = Color.FromArgb(r.Next(255), r.Next(255), r.Next(255)); // MessageBox.Show((c == new HSVColor(c).RgbColor).ToString()); beingused = new List<ingred>(); items = new ingred[8]; items[0] = new ingred(PctColor, LblPosneg, PrgTimer); items[1] = new ingred(pictureBox1, label1, progressBar1); items[2] = new ingred(pictureBox2, label2, progressBar2); items[3] = new ingred(pictureBox3, label3, progressBar3); items[4] = new ingred(pictureBox4, label4, progressBar4); items[5] = new ingred(pictureBox5, label5, progressBar5); items[6] = new ingred(pictureBox6, label6, progressBar6); items[7] = new ingred(pictureBox7, label7, progressBar7); tmr.Tick += Tmr_Tick; double p1 = r.Next(255); RightTarget.BackColor = new HSVColor(p1,satuationVal, ValueVal).RgbColor;// Color.FromArgb(r.Next(255), r.Next(255), r.Next(255)); LeftTarget.BackColor = new HSVColor(255-p1, satuationVal, ValueVal).RgbColor;// Color.FromArgb(r.Next(255), r.Next(255), r.Next(255)); foreach (ingred i in items) { CreateIng(i); } tmr.Enabled = true; ShowResults(); }
private void CreateIng(ingred ingred) { ingred.p.BackColor = new HSVColor(r.Next(255), satuationVal, ValueVal).RgbColor; ingred.pos.Text = r.Next(2) == 0 ? "-" : "+"; ingred.prg.Maximum = (r.Next(5) + 1) * 100; ingred.prg.Value = ingred.prg.Maximum; ingred.prg.Visible = false; }
void useing(ingred ing, bool use) { if (!beingused.Contains(ing)) { if (use) Cauldren.BackColor = Combine(Cauldren.BackColor, ing.p.BackColor, ing.pos.Text); ing.prg.Visible = true; beingused.Add(ing); } }
void useing(ingred ing) { useing(ing, true); }