Photo 5: Mark the new box
Trace the profile of the new box onto the wall with one side held along the stud. Use a sharp pencil. Don't trace or cut around the flanges!
Read more: http://www.familyhandyman.com/electrical/wiring-switches/how-to-install-dimmer-switches/view-all#ixzz3Qg7aYKFO