1) Open the icon/image you wish to add a border to. (if it is an icon, make sure it is 100 x 100 pixels!)
2) First, make a new layer by going to Layer > New > Layer...
3) Make sure the new layer is selected, and right click on it in the Layers Pallette Menu.
4) Select "Blending Options" and check the box at the bottom called "Stroke".
5) To make a standard, solid border around the image, change size to 1 pixel, position to Inside, and change the color to whatever fits the image/icon best. For this tutorial, I will use a black border.
6) Now, if you still cannot tell that there has been a border added, select the entire layer you have just added the border to with the Rectangular Marquee Tool.
7) Now go to Edit > Stroke. Make sure Width is set to 1 px and you can leave the color as is, it will not show up on the final copy. Make Location either Inside or Center, and leave everything else as is.
8) There you have it! Now your image/icon has a solid border around it!
Now, to make your icon/image have a dashed border around it, you must:
1) Start a new document (File > New) and make settings as follows:
2) Zoom in as much as you can and select the Pencil tool.
3) Fill in the top left-hand corner with black (or whatever color you want the dashes to be) and the bottom right-hand corner as well. It should look like this:
4) Now go to Edit > Define Pattern and put any name you want (i.e. 4x4 dashed border).
5) Next, open your icon/image, and do the same thing you did to make the solid border around the icon/image up to Step 4 (above).
6) From here, instead of leaving it "Color", select "Pattern" from the drop-down menu.
7) Next to where it says Pattern, you can select the pattern you just made. Click OK.
8) For this to take effect, do steps 6-7 from the solid border tutorial above, and, wahla! You've made a dashed border!
Play around with colors and different size borders (like 2 x 2 pixels dashed border) to get different effects!