An ice compress is also recommended when you hurt your leg (knee, ankle, toe, etc.) while playing, running, exercising, cycling or while doing other physical activities. Using an ice compress prevents swelling and the pain will considerably diminish. You should continue using an ice compress for a few days until the pain has completely disappeared.