1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70:
| private void RenderLabels(PictureBox pbOne, PictureBox pbTwo, PictureBox pbThree, Panel pnl) { if (CalcRand == true) {
int rnd1 = rnd.Next(0, 3); int rnd2 = rnd.Next(0, 3);
if (rnd1 == 0) { pbOne.Image = herz; } if (rnd1 == 1) { pbTwo.Image = herz; } if (rnd1 == 2) { pbThree.Image = herz; }
if (rnd2 == 0) { pbOne.Image = dollar; } if (rnd2 == 1) { pbTwo.Image = dollar; } if (rnd2 == 2) { pbThree.Image = dollar; } CalcRand = false; } PictureBox[] pics = new PictureBox[3] { pbOne, pbTwo, pbThree }; foreach (PictureBox pic in pics) { if (pic.Image == dollar) { pic.Size = new Size(pic.Width, pic.Height); pic.Location = new Point(pnl.Width / 2 - dollar.Width / 2, pnl.Height / 2 - dollar.Height / 2); } if (pic.Image == herz) { pic.Size = new Size(herz.Width, herz.Height); pic.Location = new Point(pnl.Width / 2 - herz.Width / 2, pnl.Height / 2 - herz.Height / 2); } }
if (pbOne.Location.Y > pnl.Height - 30) { pbOne.Location = new Point(pbOne.Location.X, -30); CalcRand = true; } if (pbTwo.Location.Y > pnl.Height - 30) { pbTwo.Location = new Point(pbTwo.Location.X, -30); CalcRand = true; } if (pbThree.Location.Y > pnl.Height - 30) { pbThree.Location = new Point(pbThree.Location.X, -30); CalcRand = true; }
pbOne.Location = new Point(pbOne.Location.X, pbOne.Location.Y + speed); pbTwo.Location = new Point(pbTwo.Location.X, pbTwo.Location.Y + speed); pbThree.Location = new Point(pbThree.Location.X, pbThree.Location.Y + speed); } |