Gravitational Lensing by a Structure in a Cosmological Background