Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            CompoundGraphic root = new CompoundGraphic();

            root.Add(new Dot(0, 0));
            root.Add(new Dot(1, 1));
            root.Move(2, 2);

            CompoundGraphic comp = new CompoundGraphic();

            comp.Add(new Dot(3, 3));
            comp.Add(new Dot(4, 4));
            root.Add(comp);
            root.Add(new Dot(5, 5));

            CompoundGraphic circleComp = new CompoundGraphic();

            circleComp.Add(new Circle(3, 3, 3));
            circleComp.Draw(); //not draw circle why?

            Dot d = new Dot(6, 6);

            root.Add(d);
            root.Remove(d);
        }
Ejemplo n.º 2
0
        static void Main()
        {
            var graphic = new CompoundGraphic();

            graphic.Add(new Point(3, 4));
            graphic.Add(new Point(4, 1));
            graphic.Add(new Point(8, 1));

            graphic.Move(1, 1);

            graphic.Draw();
        }
Ejemplo n.º 3
0
        public IEnumerable <string> DrawStuff()
        {
            List <string> _events = new List <string>();

            void AddToEventLog(object sender, string e)
            {
                _events.Add(e);
            }

            /*
             *
             * compound0___________
             |                   |
             | compound1__         compound2_____
             |          |        |             |
             | dot1       circle   compound3     dot2
             |
             |                   circle2
             */

            // Setup

            var dot1    = new Dot(3, 4);
            var dot2    = new Dot(0, 0);
            var circle  = new Circle(5, 6, 100);
            var circle2 = new Circle(55, 66, 77);

            var compound0 = new CompoundGraphic();
            var compound1 = new CompoundGraphic();
            var compound2 = new CompoundGraphic();
            var compound3 = new CompoundGraphic();

            compound1.Add(dot1, circle);
            compound2.Add(compound3, dot2);
            compound3.Add(circle2);
            compound0.Add(compound1, compound2);

            dot1.OnDraw    += AddToEventLog;
            dot2.OnDraw    += AddToEventLog;
            circle.OnDraw  += AddToEventLog;
            circle2.OnDraw += AddToEventLog;

            // Action

            dot1.Draw();
            circle.Move(20, 30);
            circle.Draw();

            compound0.Move(500, 600);
            compound0.Draw();

            return(_events);
        }