Forum Moderators: not2easy
Create a 2px by 1px document, with one pixel white (or transparent) and the other black, in either a portrait or landscape layout depending on the direction of the line you are drawing.
Then select the whole document and create a fill pattern (Edit>Define Pattern).
Next, use the shape tool to create a 1px width line in the position you need and create a blank layer above the shape layer.
Then select the whole of the blank layer and fill it using the pattern you just created (Edit>Fill...)
Lastly, hitting ctrl+g with the fill layer selected will group those layers together creating a dotted line.
The good thing about this method is that you can alter the fill pattern to suit any type of line you need, whether it be dotted, dashed or a custom pattern.
Here you can do some pretty cool stuff by selecting various attributes of brushes.
Select a round brush of your choosing and with the aforementioned brush palette open, click where it says, "Brush Tip Shape", then play around with the brush size and spacing until you find a distance you are happy with. Simple as that!
Remember that holding down the Shift key when you are painting and you'll always get a straight line.
Hope this helps.