Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Professional Visual Studio 2005 (2006) [eng]

.pdf
Скачиваний:
117
Добавлен:
16.08.2013
Размер:
21.9 Mб
Скачать

Workspace Control

The opening chapters of this book described several of the windows that are built into Visual Studio 2005 to help you visualize your application. This chapter provides a summary of all the available windows and their functionality. Where these windows are covered in more detail in other chapters, cross-references are provided so information isn’t duplicated. In addition, several shortcuts and techniques are presented in this chapter to help you build applications with Visual Studio 2005.

Visual Studio 2005 Windows

Visual Studio 2005 has numerous windows that can help you visualize your application, or aid in writing or debugging code. This section provides an outline of most of these windows. A crossreference is provided where a windows is covered in more detail in another chapter. Not all of these windows are available in the Professional version of Visual Studio 2005. Windows available only in the Team Suite version are appropriately marked.

Start Page

Figure 35-1 shows the Start page that is initially displayed when you open Visual Studio 2005. Depending on your selected profile, different articles are loaded from MSDN.

The Start page is available for all versions of Visual Studio 2005. It can be disabled via the Options item on the Tools menu.

Chapter 35

Figure 35-1

Code/Designer

The main window, which appears in the center of Visual Studio 2005 and is shown in Figure 35-2, houses code files, the design surface for windows forms, web forms, components, and data designers. The main window is also used by default by some of the other Visual Studio 2005 windows. With the new window docking feature, any window can be displayed in the main window, pinned to an edge, or left floating.

Figure 35-2

Further information about the code window can be found in Chapter 1 and Chapter 5, in the discussion on customizing window layout.

Solution Explorer

The Solution Explorer shows the layout of the files that make up your application. In Visual Studio 2005, the default view hides many of the designer-generated files so the solution appears less cluttered. In Figure 35-3, the Show All Files button has been toggled so you can see all the files associated with this application.

458

Workspace Control

Figure 35-3

More information on the Solution Explorer is available in Chapters 1 and 4.

Properties

Properties associated with the currently selected object are displayed in the Properties window shown in Figure 35-4. This window provides a visual interface to the code that ultimately sets these properties at runtime.

Figure 35-4

More information on the Properties window is available in Chapter 1.

Toolbox

Figure 35-5 shows the Toolbox that is displayed when editing a file using the designer surface. Different designers have different sets of controls, so the Toolbox is dynamically adjusted to include items relevant in the current context.

Figure 35-5

More information on the Toolbox is available in Chapter 1.

459

Chapter 35

Server Explorer

The Server Explorer, shown in Figure 35-6, provides a link between Visual Studio 2005 and your computer. The first node shows the list of data connections that have been used in the past. Each data connection is represented by a separate node through which that database can be manipulated. The second node lists the servers that have been connected. By default, the local computer appears in this list, but any other computer that you have permissions to access can be connected to. Each computer has a series of nodes that represent the hardware and services available. For example, the Event Viewer can be launched from the right-click context menu off the Event Logs node.

Figure 35-6

Other nodes can be dragged onto the designer surface to create a component that can be used to interact with that node. For example, dragging a service from the Services list onto a form will add a Service Controller component to the nonvisual area on the design surface. This enables the service to be controlled from the form.

Error List

Any errors or warnings that occur during compilation are added to the Error List, as shown in Figure 35-7. Toggling the buttons will show or hide errors, warnings, and messages so you can work through any issues in your application. The list of columns can be adjusted to customize the Error List to provide the information you need.

460

Workspace Control

Figure 35-7

More information on the Error List is available in Chapter 1.

Object Browser

Figure 35-8 shows the Object Browser, which you can use to search or navigate the list of referenced types. This can be useful for locating a type when you only remember part of the name or for determining what methods are available for a particular type.

Figure 35-8

In the lower-right pane, information about the selected method is provided, including a summary of the method and a list of the parameters it expects.

Task List

Visual Studio 2005 has a separate Task List that you can use to track outstanding tasks. Tasks can be added using special TODO comments, which will appear to all users making changes to the code, as shown in Figure 35-9. Alternative tasks can be added directly into the task pane but will only be available to that user. The user tasks can be seen by selecting User Tasks from the drop-down box.

Figure 35-9

461

Chapter 35

More information on working with the Task List is available in Chapter 2.

Class View

In Figure 35-10 the Class View shows part of the inheritance hierarchy for Form1 in the WorkspaceSample namespace. This view is useful if you have a deep inheritance model or need to remember a method name.

Figure 35-10

The Class View window can also be used to open the class diagram or to create an instance of a class using the Object Test Bench.

Code Definition

Figure 35-11 shows the Code Definition window, which appears underneath the code window and displays the definition of the symbol that was last selected. Although the code can’t be edited in the Code Definition window, the code window can be moved to the definition line from the right-click context menu.

Figure 35-11

462

Workspace Control

This feature works only for C# and C++ code files.

Output

The Output window has a dual purpose — first, to show the status during compilation; and second, to display any output that the application may have written to the console. Errors during the build process will be displayed in the Build output, while application output will display in the Debug output. This can be selected using the drop-down shown in Figure 35-12.

Figure 35-12

More information on the Output window is available in Chapter 49.

Find Results

The Find Results window, shown in Figure 35-13, displays the results of a search, using Find in Files. Double-clicking a line in the results window will open the appropriate code window.

Figure 35-13

There are multiple Find Results windows, and the find results can be directed to the appropriate window from the Find and Replace dialog under the Result options. This window is covered in more detail in the next chapter.

Call Browser

The Call Browser, available to C++ developers, can be used to locate where a method is being called from, as shown in Figure 35-14, and to navigate to other methods it calls.

To launch the Call Browser, select either Show Callers Graph or Show Call Graph from the Call Browser item on the right-click context menu for the method you are interested in.

463

Chapter 35

Figure 35-14

Command Window

Most macros and built-in commands can be invoked using either a key combination or a menu. The Command Window can be used to invoke a Visual Studio 2005 command or macro by name.

In Figure 35-15, the View.SolutionExplorer command was executed to display the Solution Explorer. On the last line, a new command has been started and IntelliSense has kicked in to provide autocompletion once a command or macro with the correct name has been located.

Figure 35-15

Document Outline

Most ASP.NET developers will be familiar with the Document Outline window, which displays the hierarchy of HTML tags. This window can now be used by Windows application developers to show the nesting of controls on a form, as shown in Figure 35-16.

Figure 35-16

More information on the Document Outline window is available in Chapter 13.

464

Workspace Control

Object Test Bench

When coding a class, we often want to create an instance without running the entire application. This is where the Object Test Bench can be used to house an instance of the class and enable you to invoke methods. Figure 35-17 shows an instance of the SplashScreen form, and from the right-click context menu you can invoke the button1_Click method.

Figure 35-17

More information on using the Object Test Bench is provided in Chapter 14.

Performance Explorer

Once the Performance Wizard has been run, the options can be configured via the Performance Explorer window, shown in Figure 35-18. Each time the performance tool is executed, a new report is generated, which can be used to analyze memory allocation, object lifetime, and garbage collection performance.

Figure 35-18

More information on the Performance Explorer is available in Chapter 56. This window is only available as part of the Team Suite version of Visual Studio 2005.

Property Manager

Unlike C# and VB.NET, which use the new Project Properties window, C++ projects use the Property Manager to configure property sheets that can be applied to one or more project configurations. Figure 35-19 shows debug and release configurations for a project, with an additional property sheet being applied to the debug configuration.

465