void tmpSeat_Click(object sender, EventArgs e) { SeatB tmpS = (SeatB)sender; if (tmpS.SeatStatus == Status.Free) { tmpS.SeatStatus = Status.Purchased; tmpSeat = new Seat(lstSeats.Count, x, y, Status.Purchased); lstSeats.Add(tmpSeat); } }
private void Generate(int rows, int columns) { for (y = 0; y < rows; y++) { for (x = 0; x < columns; x++) { SeatB tmpSeat = new SeatB(); tmpSeat.Width = width; tmpSeat.Height = height; tmpSeat.Top = ySPacing * y; tmpSeat.Left = xSpacing * x; tmpSeat.SeatStatus = defaultStatus; tmpSeat.Click += tmpSeat_Click; tmpSeat.Text = "r" + y + "c" + x; this.Controls.Add(tmpSeat); } } }