示例#1
0
 private void btnMoon_Click(object sender, EventArgs e)
 {
     moon   = new Moon();
     moon.g = Graphics.FromImage(b);
     moon.DrawMoon();
     pictureBox1.Image  = b;
     txtInfo.Text      += "Координаты луны:" + Environment.NewLine;
     txtInfo.Text      += "x=" + moon.point[0].X + ";y=" + moon.point[0].Y + Environment.NewLine;
     timerStars.Enabled = true;
 }
示例#2
0
        public void DrawStars(int w, Moon m)
        {
            CoreDrawCity city = new CoreDrawCity(w);
            Random       rnd  = new Random();

            Point[] p = new Point[4];
            for (int i = 0; i < 100; i++)
            {
                p[0].X = rnd.Next(10, w - 10);
                p[0].Y = rnd.Next(10, city.UNDERGROUND - 125);
                p[1].X = p[0].X + 2;
                p[1].Y = p[0].Y;
                p[2].X = p[0].X + 2;
                p[2].Y = p[0].Y + 2;
                p[3].X = p[0].X;
                p[3].Y = p[0].Y + 2;
                if ((p[0].X <m.point[0].X - 5 || p[0].X> m.point[0].X + m.width + 5) ||
                    (p[0].Y <m.point[0].Y - 5 || p[0].Y> m.point[0].Y + m.height + 5))
                {
                    g.DrawPolygon(pen, p);
                    g.FillPolygon(brush, p);
                }
            }
        }
示例#3
0
 public void add_bodies()
 {
     cosmic_bodies[0] = new Earth();
     cosmic_bodies[1] = new Moon();
 }