View Single Post
  #2 (permalink)  
Old April 11th, 2011, 02:31 PM
Rod Stephens's Avatar
Rod Stephens Rod Stephens is offline
Wrox Author
Points: 3,166, Level: 23
Points: 3,166, Level: 23 Points: 3,166, Level: 23 Points: 3,166, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jan 2006
Location: , , .
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts

Hi Jim,

It depends a bit on what you want to do with the files. Two common reasons are (1) to manage the file with the rest of the project and (2) to use it as an image in a PictureBox or something similar.

(1) To manage the file with the rest of the project. For example, you might want to set the file's "Copy to Output Directory" property to True so it gets copied into the executable directory so the exe can find it easily.

To do this, open the Project menu and select Add Existing Item. (Alternatively right-click the project in Solution Explorer, open the Add submenu, and select Existing Item.) Select the file and click Add.

Now you can click the file in Solution Explorer and set Copy to Output Directory. Depending on the version of Visual Studio, you may also be able to double-click the file to open it in an editor.

(2) To display the file in a PictureBox. First, you don't need to add the file to the project in the way described above.

Click on the PictureBox. In the Properties window, click on the Image property, and then click on the ellipsis to the right. A dialog appears showing images that have already been imported for use. If the image you want isn't there (it won't be initially), click the Import button, find the file, and click Open.

Now the image should appear in the list of imported files. Select it and click OK to use it as the PictureBox's image.

You may then want to set the PictureBox's SizeMode property, for example to AutoSize or Zoom.

Let me know if that doesn't answer your question.

Great book and accompanying presentations. If you had an audio only version the presentations woudl blegood reviews to listen to in the car.
I'm glad you're finding it useful. Post a review when you get a chance!

I'll have to think about audio-only material. It would have to be a topic where you don't need to see anything to make sense of it. It might also be good if it weren't too distracting so you don't crash your car while listening . It might be good for broad principle, background, and design topics, though. Hmm...

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)