예제 #1
0
        // -------------------------------------------------
        public Form_ManyMovers ()
        {
            InitializeComponent ();

            moverControls = new Mover (this);
            moverCircle = new Mover (this);
            moverSquare = new Mover (this);
            moverCirclesOnPanel = new Mover ();
            moverSquaresOnPanel = new Mover ();
            moverHouses = new Mover ();

            moverControls .Clear ();
            moverControls .Insert (0, panelCircles);    // , Resizing .NS
            moverControls .Insert (0, panelSquares);    // , Resizing .WE
            moverControls .Insert (0, panelHouses);     // , Resizing .Any
            moverControls .Insert (0, labelInfo);

            moverCircle .Clear ();
            moverSquare .Clear ();

            circles = new ColoredCircle [4] { new ColoredCircle (this, new Point (70, 60), false, size [0], clrs [0]), 
                                              new ColoredCircle (this, new Point (50, 80), false, size [1], clrs [1]), 
                                              new ColoredCircle (this, new Point (80, 110), false, size [2], clrs [2]), 
                                              new ColoredCircle (this, new Point (110, 130), false, size [3], clrs [3]) };
            foreach (ColoredCircle circle in circles)
            {
                moverCircle .Add (circle);
            }

            squares = new ColoredSquare [5] { new ColoredSquare (this, new Point (200, 50), size [0], clrs [0]),    
                                              new ColoredSquare (this, new Point (240, 70), size [1], clrs [1]),    
                                              new ColoredSquare (this, new Point (270, 90), size [2], clrs [2]),    
                                              new ColoredSquare (this, new Point (300, 120), size [3], clrs [3]),    
                                              new ColoredSquare (this, new Point (280, 150), size [4], clrs [4]) }; 
            foreach (ColoredSquare square in squares)
            {
                moverSquare .Add (square);
            }

            moverCirclesOnPanel .Clear ();
            circlesOnPanel = new ColoredCircle [4] {new ColoredCircle (this, new Point (30, 40), false, size [0], clrs [0]),       
                                                    new ColoredCircle (this, new Point (60, 65), false, size [1], clrs [1]),       
                                                    new ColoredCircle (this, new Point (90, 90), false, size [2], clrs [2]),       
                                                    new ColoredCircle (this, new Point (120, 115), false, size [3], clrs [3]) };   
            foreach (ColoredCircle circle in circlesOnPanel)
            {
                moverCirclesOnPanel .Add (circle);
            }

            moverSquaresOnPanel .Clear ();
            squaresOnPanel = new ColoredSquare [] { new ColoredSquare (this, new Point (30, 40), size [0], clrs [0]), 
                                                    new ColoredSquare (this, new Point (60, 65), size [1], clrs [1]),
                                                    new ColoredSquare (this, new Point (90, 90), size [2], clrs [2]) };
            foreach (ColoredSquare square in squaresOnPanel)
            {
                moverSquaresOnPanel .Add (square);
            }

            moverHouses .Clear ();
            Font fnt = new Font ("Times New Roman", 12, FontStyle .Bold | FontStyle .Italic);
            Rectangle rc = new Rectangle (30, 40, 80, 200);
            house4 = new SimpleHouse (4, fnt, 30, rc, new Point ((rc .Left + rc .Right) / 2, rc .Top - 30), Color .Yellow, Color .Brown);
            house4 .NumberColor = Color .White;
            
            rc = new Rectangle (160, 90, 110, 80);
            house17 = new SimpleHouse (17, fnt, 20, rc, new Point ((rc .Left + rc .Right) / 2, rc .Top - 70), Color .LightGreen, Color .Red);
            house17 .WindowColor = Color .Blue;
            moverHouses .Add (house4);
            moverHouses .Add (house17);

            //panelHouses .Set
        }