- Starting C#
- Creating a New Project
- Understanding the C# Environment
- Changing the Characteristics of Objects
- Naming Objects
- Setting the Text Property of the Form
- Giving the Form an Icon
- Changing the Size of the Form
- Adding Controls to a Form
- Designing an Interface
- Adding an Invisible Control to a Form
- Coding an Interface
- Running a Project
- Summary
- Q&A
Giving the Form an Icon
Everyone who has used Windows is familiar with icons, which are the little pictures used to represent programs. Icons most commonly appear in the Start menu next to the name of their respective programs. In C#, you not only have control over the icon of your program file, you can also give every form in your program a unique icon if you want to.
NOTE
The instructions that follow assume you have access to the source files for the examples in this book. They are available at http://www.samspublishing.com/detail_sams.cfm?item=0672320800. You don't have to use the icon I've provided for this example; you can use any icon of your choice. If you don't have an icon available, you can skip this section without affecting the outcome of the example.
To give the form an icon, follow these steps:
In the Properties window, click the Icon property to select it.
When you click the Icon property, a small button with three dots appears to the right of the property. Click this button.
To locate the HourOne.ico file or another ico file of your choice, use the Open dialog box that appears. When you've found the icon, double-click it, or click it once to select it and then click Open.
After you've selected the icon, it appears in the Icon property along with the word (Icon). A small version of the icon appears in the upper-left corner of the form, as well. Whenever this form is minimized, this is the icon that's displayed on the Windows taskbar. (Note: This doesn't change the icon for the project as a whole. In Hour 22, you'll learn how to assign an icon to your distributable file.)