public List <ButtonView> getButtonsView() { List <ButtonView> buttonsView = new List <ButtonView>(); foreach (ButtonController button in model.Buttons) { ButtonView buttonView = button.getView(); buttonsView.Add(buttonView); } return(buttonsView); }
private void TicTacToeView_Load(object sender, EventArgs e) { List <ButtonView> buttons = controller.getButtonsView(); int buttonWidth = buttons.First().Width; int buttonHeight = buttons.First().Height;/*deze was nodig voor de smijt ze allemaal knop * er onderaan bij te plaatsen -> kan dus van PasswordPropertyTextAttribute komen? */ foreach (ButtonView button in buttons) { ButtonView currentButton = button; int xPos = buttons.IndexOf(button) % buttonRow * buttonWidth; int yPos = buttons.IndexOf(button) / buttonRow * buttonHeight; currentButton.Location = new Point(xPos, yPos); Controls.Add(currentButton); } }
public ButtonController() { model = new ButtonModel(); view = new ButtonView(this); }