private void OnClick(object sender, MouseEventArgs e) { ButtonSquare square = ((ButtonSquare)sender); switch (e.Button) { case MouseButtons.Left: game.Uncover(square.Position); paintButtons(); break; case MouseButtons.Right: game.ToggleFlag(square.Position); paintButtons(); break; default: break; } }