Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Graphics g = this.panel1.CreateGraphics();

            thucan      = new ThucAn();
            thucan.TyLe = 50;
            thucan.X    = (int)(this.panel1.Width / thucan.TyLe);
            thucan.Y    = (int)(this.panel1.Height / thucan.TyLe);

            thucan.g = g;
            thucan.VeThucAn(false);
            g.Dispose();
        }
Exemple #2
0
        private void TaoThucAn()
        {
            thucan      = new ThucAn();
            thucan.TyLe = snack.TyLe;
            Random rnd = new Random();
            int    x   = rnd.Next((int)(this.panel1.Width / thucan.TyLe));
            int    y   = rnd.Next((int)(this.panel1.Height / thucan.TyLe));

            thucan.X = x;
            thucan.Y = y;
            thucan.g = g;
            thucan.VeThucAn(false);
        }
Exemple #3
0
 private void LamSach()
 {
     snack  = null;
     thucan = null;
     g.Clear(Color.FromName(this.panel1.BackColor.Name.ToString()));
 }