Autor Beitrag
ThomAlex
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 58

Windows 7
C# (VS08) Games via XNA (privat) oder WinForms (Schule)
BeitragVerfasst: Mo 19.04.10 23:06 
Hallo an alle,

ich versuche zurzeit eine SlotMachine zu programmieren und das klappte bis vor kurzem gut. Als ich Labels in Panels runterlaufen ließ und von oben wieder auftauchen ließ klappte dies einwandfrei nun ging dies auch mit Pictureboxes bis ich irgendwas notwendiges verändert habe und nun stocken die in der Mitte. Was das war hab ich nicht rausgefunden, weil ich zu lange nichtmehr getestet habe und nun nicht weiß was falsch ist.

Ich denke in dieser Methode muss der Fehler sein, bin mir aber nicht sicher.
ausblenden volle Höhe C#-Quelltext
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)//Kollision, Zeichnung, Bewegung
        {
            if (CalcRand == true)
            {

                int rnd1 = rnd.Next(03);
                int rnd2 = rnd.Next(03);

                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);//Bmp befindet sich im Container Panel
                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);
        }


Glaube einige Information muss ich noch geben, sagt mir was ihr braucht und hoffentlich könnt ihr helfen, Danke.