Running a Project


Your application is now complete. Click the Save All button on the toolbar (it looks like a stack of disks), and then run your program by pressing F5. You can also run the program by clicking the button on the toolbar that looks like a right-facing triangle and resembles the Play button on a VCR (this button is called Start, and it can also be found on the Debug menu). Learning the keyboard shortcuts will make your development process move along faster, so I recommend you use them whenever possible.

When you run the program, the Visual C# interface changes, and the form you've designed appears floating over the design environment (see Figure 1.14).

Figure 1.14. When in Run mode, your program executes the same as it would for an end user.


You are now running your program as though it were a standalone application running on another user's machine; what you see is exactly what users would see if they ran the program (without the Visual Studio .NET design environment in the background, of course). Click the Select Picture button to display the Select Picture dialog box (see Figure 1.15). Use the dialog box to locate a picture file. When you've found a file, double-click it, or click once to select it and then click Open. The selected picture is then displayed in the picture box, as shown in Figure 1.16.

Figure 1.15. The OpenFileDialog control handles all the details of browsing for files. Cool, huh?


Figure 1.16. Visual C# makes it easy to display pictures with very little work.


By the Way

When you click the Select Picture button, the default path shown depends on the last active path in Windows, so it will be different for you than shown in Figure 1.15.


By the Way

If you want to select and display a picture from your digital camera, chances are the format is JPEG, so you'll need to select this from the Files of type drop-down. Also, if your image is very large, you'll see only the upper-left corner of the image (what fits in the picture box). In later hours, I'll show you how you can scale the image to fit the picture box, and even resize the form to show a larger picture in its entirety.





Sams Teach Yourself Microsoft Visual C# 2005 in 24 Hours, Complete Starter Kit
Sams Teach Yourself Visual C# 2005 in 24 Hours, Complete Starter Kit
ISBN: 0672327406
EAN: 2147483647
Year: N/A
Pages: 248
Authors: James Foxall

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net