Example #1
0
        }                                           //Занимаемый прямоугольник на элементе управления

        public CinemaPlace(int row, int place, PLACE_STATE state, RectangleF rect)
        {
            Row       = row;
            Place     = place;
            State     = state;
            PlaceRect = rect;
        }
Example #2
0
        public Placer(int rows, int places, List <Point> soldPlaces) : this()
        {
            if (rows <= 0 || rows > 40 || places <= 0 || places > 40)
            {
                throw new ApplicationException("Неправильно заданы размеры кинозала");
            }

            this.Rows       = rows;
            this.Places     = places;
            this.basePoint  = new Point(Width / (Places + 1), 0);
            this.delta      = 4.0f;
            this.SoldPlaces = soldPlaces;

            //Создание списка мест

            float placeWidth  = (float)(Width - basePoint.X) / Places;
            float placeHeight = (float)(Height - basePoint.Y) / Rows;

            for (int row = 0; row < Rows; row++)
            {
                for (int place = 0; place < Places; place++)
                {
                    RectangleF R = new RectangleF(
                        basePoint.X + place * placeWidth + delta,
                        basePoint.Y + row * placeHeight + delta,
                        placeWidth - delta,
                        placeHeight - delta);
                    PLACE_STATE state = SoldPlaces.Contains(new Point(row + 1, place + 1)) ? PLACE_STATE.BUSY : PLACE_STATE.FREE;
                    placesList.Add(new CinemaPlace(row, place, state, R));
                }
            }
        }
Example #3
0
 public CinemaPlace(int row, int place, PLACE_STATE state, RectangleF rect)
 {
     Row = row;
     Place = place;
     State = state;
     PlaceRect = rect;
 }