Fit grid into window