Esempio n. 1
0
        private void Form1_Click(object sender, EventArgs e)
        {
            Pen p = new Pen(Color.Yellow);
            PersonThinBuilder ptb = new PersonThinBuilder(pictureBox1.CreateGraphics(), p);
            PersonDirector    pd  = new PersonDirector(ptb);

            pd.GreatePerson();
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Pen p = new Pen(Color.Black);
            PersonThinBuilder pb = new PersonThinBuilder(pictureBox1.CreateGraphics(), p);
            PersonDirector    pd = new PersonDirector(pb);

            pd.BuildPerson();
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Pen               p       = new Pen(Color.Aqua);
            Graphics          gThin   = Graphics.FromImage(new Bitmap(50, 50));
            PersonThinBuilder ptb     = new PersonThinBuilder(gThin, p);
            PersonDirector    xiaohei = new PersonDirector(ptb);

            xiaohei.CreatePerson();
            Console.WriteLine(xiaohei);
            Console.Read();
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            ThinPersonBuilder thinPersonBuilder = new ThinPersonBuilder(null, null);
            FatPersonBuilder  fatPersonBuilder  = new FatPersonBuilder(null, null);
            PersonDirector    director          = new PersonDirector(fatPersonBuilder);

            Console.WriteLine("<============== Build fat person ==============>");
            director.CreatePerson();
            Console.WriteLine("<============== Build fat person ==============>");

            Console.WriteLine();
            director = new PersonDirector(thinPersonBuilder);
            Console.WriteLine("<============== Build thin person ==============>");
            director.CreatePerson();
            Console.WriteLine("<============== Build thin person ==============>");

            Console.ReadKey();
        }