How did Hitler gain so much power?

he was voted president then changed it to a dictatorship.