I've used the balloon method before, as Ingrid suggested. I found that it worked well.
I just washed the hat gently, then placed the hat over the balloon as I inflated it. I left the hat over the balloon to dry, and it helped to make sure that everything dried straight and kept it's proper shape.
Just make sure that you don't over-inflate your balloon ... you don't want to stretch out your hat! You have to remember that your hat will keep the shape that you blocked it in (at least to some extent), so if it dries overly stretched out it will stay like that. So only inflate your balloon until it just fits inside your hat (unless you're trying to stretch it out a little I suppose, but I'm assuming that you've knit it to the correct size).