By using a straight edge and/or a level. A straight edge can be anything from a piece of wood or metal to a ruler or some other type of measuring device. A level is used to ensure that the surface you're painting on is perfectly horizontal or vertical. This is especially important when you're painting vertical lines since if they're not perfectly straight, they'll look skewed when the paint dries..