Such events are not due primarily to the food from your diet but rather to administered drugs.
When a strict weight control is followed, especially if the organism is sick, some extra attention should be given to the prescribed drugs because it can reach gaining very much weight as a side effect of administration of such drugs.
Among the drugs known for their negative role on weight control a wide range of antidepressants is included. These are used to treat psychiatric disorders, but there are also prescribed corticosteroids to combat various states of inflammation of the body, and insulin and other anti-diabetic.
Usually, weight gain associated with medications (recommended for certain diseases) will be accompanied by fluid retention, another negative factor that automatically leads to this problem.
It is a must in such situations to discuss with your doctor immediately once you observed that you started to gain weight more that usual. The doctor is supposed to adjust the daily doses of medication or even change it completely. We must not forget additional physical movement and daily activities, which will help significantly to a better control of your body.