Navigating the Visual Studio 2005 IDE

Table of contents:

The IDE provides windows for accessing project files and customizing controls. In this section, we introduce several windows that you will use frequently when developing Visual C# programs. These windows can be accessed via toolbar icons (Fig. 2.13) or by selecting the name of the desired window in the View menu.

Figure 2.13. Toolbar icons for three Visual Studio windows.

(This item is displayed on page 46 in the print version)

Visual Studio provides a space-saving feature called auto-hide. When auto-hide is enabled, a tab appears along either the left or right edge of the IDE window (Fig. 2.14). This tab contains one or more icons, each of which identifies a hidden window. Placing the mouse pointer over one of these icons displays that window (Fig. 2.15). The window is hidden again when the mouse pointer is moved outside of the window's area. To "pin down" a window (i.e., to disable auto-hide and keep the window open), click the pin icon. Note that when auto-hide is enabled, the pin icon is horizontal (Fig. 2.15), whereas when a window is "pinned down," the pin icon is vertical (Fig. 2.16).

Figure 2.14. Auto-hide feature demonstration.

Figure 2.15. Displaying a hidden window when auto-hide is enabled.

(This item is displayed on page 47 in the print version)

Figure 2.16. Disabling auto-hide ("pinning down" a window).

(This item is displayed on page 47 in the print version)

The next few sections overview three of the main windows used in Visual Studiothe Solution Explorer, the Toolbox and the Properties window. These windows show information about the project and include tools that will help you build your programs.

2.4.1. Solution Explorer

The Solution Explorer window (Fig. 2.17) provides access to all of the files in a solution. If the Solution Explorer window is not shown in the IDE, select View > Solution Explorer or click the Solution Explorer icon (Fig. 2.13). When you first open Visual Studio, the Solution Explorer is empty; there are no files to display. Once you open a solution, the Solution Explorer displays the contents of the solution and its projects or when you create a new project, its contents are displayed.

Figure 2.17. Solution Explorer with an open project.

The solution's startup project is the project that runs when the program executes. If you have multiple projects in a given solution, you can specify the startup project by right-clicking the project name in the Solution Explorer window, then selecting Set as StartUp Project. For a single-project solution, the startup project is the only project (in this case, WindowsApplication1) and the project name appears in bold text in the Solution Explorer window. All of the programs discussed in this text are single-project solutions. For programmers using Visual Studio for the first time, the Solution Explorer window lists only the Properties, References, Form1.cs and Program.cs files (Fig. 2.17). The Solution Explorer window includes a toolbar that contains several icons.

The Visual C# file that corresponds to the form shown in Fig. 2.4 is named Form1.cs (selected in Fig. 2.17). (Visual C# files use the .cs filename extension, which is short for "C Sharp.")

By default, the IDE displays only files that you may need to editother files generated by the IDE are hidden. When clicked, the Show all files icon (Fig. 2.17) displays all the files in the solution, including those generated by the IDE. The plus and minus boxes that appear (Fig. 2.18) can be clicked to expand and collapse the project tree, respectively. Click the plus box to the left of Properties to display items grouped under the heading to the right of the plus box (Fig. 2.19); click the minus boxes to the left of Properties and References to collapse the tree from its expanded state (Fig. 2.20). Other Visual Studio windows also use this plus-box/minus-box convention.

Figure 2.18. Solution Explorer showing plus boxes and minus boxes for expanding and collapsing the tree to show or hide project files.

Figure 2.19. Solution Explorer expanding the Properties file after clicking its plus box.

Figure 2.20. Solution Explorer collapsing all files after clicking any minus boxes.

 

2.4.2. Toolbox

The Toolbox contains icons representing controls used to customize forms (Fig. 2.21). Using visual programming, you can "drag and drop" controls onto the form, which is faster and simpler than building them by writing GUI code (we introduce writing this type of code in Chapter 5, Control Statements: Part 1). Just as you do not need to know how to build an engine to drive a car, you do not need to know how to build controls to use them. Reusing pre-existing controls saves time and money when you develop programs. The wide variety of controls contained in the Toolbox is a powerful feature of the .NET FCL. You will use the Toolbox when you create your first program later in the chapter.

Figure 2.21. Toolbox window displaying controls for the Common Controls group.

(This item is displayed on page 50 in the print version)

The Toolbox contains groups of related controls. Examples of these groups, All Windows Forms, Common Controls, Containers, Menus & Toolbars, Data, Components, Printing, Dialogs and General, are listed in Fig. 2.21. Again, note the use of plus and minus boxes to expand or collapse a group of controls. The Toolbox contains over 65 prebuilt controls for use in Visual Studio, so you may need to scroll through the Toolbox to view additional controls other than the ones shown in Fig. 2.21. We discuss many of the Toolbox's controls and their functionality throughout the book.

2.4.3. Properties Window

To display the Properties window if it is not visible, you can select View > Properties Window, click the Properties window icon shown in Fig. 2.13 or you can press the F4 key. The Properties window displays the properties for the currently selected Form (Fig. 2.22), control or file in design view. Properties specify information about the form or control, such as its size, color and position. Each form or control has its own set of properties; a property's description is displayed at the bottom of the Properties window whenever that property is selected.

Figure 2.22. Properties window displaying the Text property of the Form.

(This item is displayed on page 51 in the print version)

Figure 2.22 shows the form's Properties window. The left column lists the Form's properties; the right column displays the current value of each property. Icons on the toolbar sort the properties either alphabetically by clicking the Alphabetical icon or categorically by clicking the Categorized icon. You can sort the properties alphabetically in ascending or descending orderclicking the Alphabetical icon repeatedly toggles between sorting the properties from AZ and ZA. Sorting by category groups the properties according to their use (i.e., Appearance, Behavior, Design). Depending on the size of the Properties window, some of the properties may be hidden from view on the screen, in which case, users can scroll through the list of properties. We show how to set individual properties later in this chapter.

The Properties window is crucial to visual programming; it allows you to modify a control's properties visually, without writing code. You can see which properties are available for modification and, where appropriate, can learn the range of acceptable values for a given property. The Properties window displays a brief description of the selected property, helping you understand its purpose. A property can be set quickly using this windowusually, only one click is required, and no code needs to be written.

At the top of the Properties window is the component selection drop-down list, which allows you to select the form or control whose properties you wish to display in the Properties window (Fig. 2.22). Using the component selection drop-down list is an alternative way to display properties without selecting the actual form or control in the GUI.

Using Help

Preface

Index

    Introduction to Computers, the Internet and Visual C#

    Introduction to the Visual C# 2005 Express Edition IDE

    Introduction to C# Applications

    Introduction to Classes and Objects

    Control Statements: Part 1

    Control Statements: Part 2

    Methods: A Deeper Look

    Arrays

    Classes and Objects: A Deeper Look

    Object-Oriented Programming: Inheritance

    Polymorphism, Interfaces & Operator Overloading

    Exception Handling

    Graphical User Interface Concepts: Part 1

    Graphical User Interface Concepts: Part 2

    Multithreading

    Strings, Characters and Regular Expressions

    Graphics and Multimedia

    Files and Streams

    Extensible Markup Language (XML)

    Database, SQL and ADO.NET

    ASP.NET 2.0, Web Forms and Web Controls

    Web Services

    Networking: Streams-Based Sockets and Datagrams

    Searching and Sorting

    Data Structures

    Generics

    Collections

    Appendix A. Operator Precedence Chart

    Appendix B. Number Systems

    Appendix C. Using the Visual Studio 2005 Debugger

    Appendix D. ASCII Character Set

    Appendix E. Unicode®

    Appendix F. Introduction to XHTML: Part 1

    Appendix G. Introduction to XHTML: Part 2

    Appendix H. HTML/XHTML Special Characters

    Appendix I. HTML/XHTML Colors

    Appendix J. ATM Case Study Code

    Appendix K. UML 2: Additional Diagram Types

    Appendix L. Simple Types

    Index



    Visual C# How to Program
    Visual C# 2005 How to Program (2nd Edition)
    ISBN: 0131525239
    EAN: 2147483647
    Year: 2004
    Pages: 600

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