Пример #1
0
        public Bolygó(GravSzim form, string név, PointD hely, PointD v, Color szín, double tömeg)
        {
            this.form     = form;
            this.Név      = név;
            this.hely     = hely;
            this.velocity = v.ToDescartes();
            this.szín     = szín;
            this.tömeg    = tömeg;
            Méret_beállítása(tömeg);;
            this.toll          = new SolidBrush(szín);
            gravitációvektorok = new List <PointD>();
            lista.Add(this);

            #region  Monitorpanelhez tartozó rész beállításai:

            kontroltömb = new Control[] { nev_label, h_label, h_textbox, v_label, v_textbox, m_label, m_textbox, szin_picturebox, törlőgomb };

            if (Bolygó.lista.Count > 3)
            {
                form.monitorpanel.Height += bolygóhelyfoglalás_monitoron;
            }

            Monitor_frissítése();
            nev_label.Text            = név;
            h_label.Text              = "hely:";
            v_label.Text              = "v = ";
            m_label.Text              = "m = ";
            m_textbox.Text            = tömeg.ToString();
            szin_picturebox.BackColor = szín;
            törlőgomb.Text            = "Töröl";


            int monitoron_hova_X = 100;
            nev_label.TextAlign = ContentAlignment.MiddleRight;
            nev_label.AutoSize  = false;
            nev_label.Width     = 100;
            nev_label.Location  = new Point(monitoron_hova_X, monitoron_hova_Y);

            monitoron_hova_X += nev_label.Width + hezag_monitoron;

            szin_picturebox.Size     = new Size(bolygóhelyfoglalás_monitoron - 5, bolygóhelyfoglalás_monitoron - 5);
            szin_picturebox.Location = new Point(monitoron_hova_X, monitoron_hova_Y);

            monitoron_hova_X += szin_picturebox.Width + hezag_monitoron;

            h_label.AutoSize  = false;
            h_label.Width     = 40;
            h_label.TextAlign = ContentAlignment.MiddleRight;
            h_label.Location  = new Point(monitoron_hova_X, monitoron_hova_Y);

            monitoron_hova_X += h_label.Width + hezag_monitoron;

            h_textbox.Width     = 100;
            h_textbox.TextAlign = HorizontalAlignment.Center;
            h_textbox.Location  = new Point(monitoron_hova_X, monitoron_hova_Y);

            monitoron_hova_X += h_textbox.Width + hezag_monitoron;

            v_label.AutoSize  = false;
            v_label.Width     = 40;
            v_label.TextAlign = ContentAlignment.MiddleRight;
            v_label.Location  = new Point(monitoron_hova_X, monitoron_hova_Y);

            monitoron_hova_X += v_label.Width + hezag_monitoron;

            v_textbox.Width     = 100;
            v_textbox.TextAlign = HorizontalAlignment.Center;
            v_textbox.Location  = new Point(monitoron_hova_X, monitoron_hova_Y);

            monitoron_hova_X += v_textbox.Width + hezag_monitoron;

            m_label.AutoSize  = false;
            m_label.Width     = 40;
            m_label.TextAlign = ContentAlignment.MiddleRight;
            m_label.Location  = new Point(monitoron_hova_X, monitoron_hova_Y);

            monitoron_hova_X += m_label.Width + hezag_monitoron;

            m_textbox.Width     = 60;
            m_textbox.TextAlign = HorizontalAlignment.Center;
            m_textbox.Location  = new Point(monitoron_hova_X, monitoron_hova_Y);

            monitoron_hova_X += m_textbox.Width + hezag_monitoron;

            törlőgomb.Location = new Point(monitoron_hova_X, monitoron_hova_Y);

            foreach (Control c in kontroltömb)
            {
                form.monitorpanel.Controls.Add(c);
            }

            monitoron_hova_Y += bolygóhelyfoglalás_monitoron;

            törlőgomb.Click += Törlés;


            #endregion
            form.Refresh();
        }
Пример #2
0
        // ITT TARTOTTUNK, még nem teszteltük, biztosan át kell még nézni.

        public void Lép()
        {
            hely += velocity;
        }