📄 apc.htm
字号:
<LI><I>Hide</I>. Hides the workspace window. To redisplay it, choose View, Workspace.
<P>
<LI><I>Properties</I>. Displays the properties of the variable (name and type).
</UL>
<P>When the main working area is displaying a source or header file, you can edit
your code as described in the later section "Editing Your Code."</P>
<P>
<H2><A NAME="Heading12"></A>Looking at Your Code, Arranged by File</H2>
<P>The FileView is much like the ClassView in that you can display and edit source
and header files (see Figure C.15). However, it gives you access to parts of your
file that are outside class definitions and makes it easy to open non-code files
like resources and plain text.</P>
<P>The project workspace window contains a tree view of the source files in your
project. The default categories used are Source Files, Header Files, Resource Files,
Help Files (if you project has Help) and External Dependencies. You can add your
own categories by right- clicking anywhere in the FileView and choosing New Folder,
and then specifying which file extensions belong in the new category.</P>
<P><A HREF="javascript:popUp('xcuvc15.gif')"><B>FIG. C.15</B></A><B> </B><I>The FileView
displays source and header files.</I></P>
<P>Double-clicking a file name displays that file in the main working area. You can
then edit the file (even if it isn't a source or header file) as described in the
later section "Editing Your Code."</P>
<P>
<H2><A NAME="Heading13"></A>Output and Error Messages</H2>
<P>Across the bottom of the Developer Studio screen is the Output view. This is a
tabbed view that shows output and error messages from a variety of Developer Studio
functions.</P>
<BLOCKQUOTE>
<P>
<HR>
<strong>TIP:</strong> If there is no Output view on your screen, choose View, Output from
the menu to restore the view.
<HR>
</BLOCKQUOTE>
<P>The five tabs in the Output view are the following:</P>
<UL>
<LI><I>Build</I>. Displays the results of compiling and linking.
<P>
<LI><I>Debug</I>. Used when debugging, as discussed in Appendix D.
<P>
<LI><I>Find in Files 1</I>. Displays the results of the Find in Files search, discussed
later in this chapter.
<P>
<LI><I>Find in Files 2</I>. An alternative display window for Find in Files results
so that you can preserve earlier results.
<P>
<LI><I>Results</I>. Displays results of tools like the profiler, discussed in Chapter
24, "Improving Your Application's Performance."
</UL>
<P>If you have installed the Enterprise Edition of Visual C++, there is a sixth tab,
SQL Debugging. For more information, see Chapter 23, "SQL and the Enterprise
Edition."</P>
<P>
<H2><A NAME="Heading14"></A>Editing Your Code</H2>
<P>For most people, editing code is the most important task you do in a development
environment. If you've used any other editor or word processor before, you can handle
the basics of the Developer Studio editor right away. You should be able to type
in code, fix your mistakes, and move around in source or header files by using the
basic Windows techniques you would expect to be able to use. Because this is a programmer's
editor, there are some nice features you should know about.</P>
<P>
<H3><A NAME="Heading15"></A>Basic Typing and Editing</H3>
<P>To add text to a file, click where you want the text to go and start typing. By
default, the editor is in Insert mode, which means your new text pushes the old text
over. To switch to Overstrike mode, press the Insert key. Now your text types over
the text that is already there. The OVR indicator on the status bar reminds you that
you are in Overstrike mode. Pressing Insert again puts you back in Insert mode. Move
around in the file by clicking with the mouse or use the cursor keys. To move a page
or more at a time, use the Page Up and Page Down keys or the scrollbar at the right
side of the main working area.</P>
<P>By default, the window for the file you are editing is maximized within the main
working area. You can click the Restore button at the top right, just under the Restore
button for all of Developer Studio, to show the file in a smaller window. If you
have several files open at once, you can arrange them so that you can see them side
by side, as shown in Figure C.16.</P>
<P><A HREF="javascript:popUp('xcuvc16.gif')"><B>FIG. C.16</B></A><B> </B><I>Your
files are in MDI windows, so you can edit several at once, side by side.</I></P>
<H3><I></I></H3>
<H3><A NAME="Heading16"></A>Working with Blocks of Text</H3>
<P>Much of the time, you will want to perform an action on a block of text within
the editor. First, select the block by clicking at one end of it and, holding the
mouse button down, moving the mouse to the other end of the block, then releasing
the mouse button. This should be familiar from so many other Windows applications.
Not surprisingly, at this point you can copy or cut the block to the Clipboard, replace
it with text you type, replace it with the current contents of the Clipboard, or
delete it.</P>
<BLOCKQUOTE>
<P>
<HR>
<strong>TIP:</strong> To select columns of text, as shown in Figure C.17, hold down the
Alt key as you select the block.
<HR>
</BLOCKQUOTE>
<H3><A NAME="Heading17"></A>Syntax Coloring</H3>
<P>You may have noticed the color scheme used to present your code. Developer Studio
highlights the elements of your code with <I>syntax coloring</I>. By default, your
code is black, with comments in green and keywords (reserved words in C++ such as
public, private, new, or int) in blue. You can also arrange for special colors for
strings, numbers, or operators (such as + and -) if you want, using the Format tab
of the Options dialog box, reached by choosing Tools, Options.</P>
<P>Syntax coloring can help you spot silly mistakes. If you forget to close a C-style
comment, the huge swath of green in your file points out the problem right away.
If you type <B>inr</B> where you meant to type <B>int</B>, the inr isn't blue, and
that alerts you to a mistyped keyword. This means you can prevent most compiler errors
before you even compile.</P>
<P><A HREF="javascript:popUp('xcuvc17.gif')"><B>FIG. C.17</B></A><B> </B><I>Selecting
columns makes fixing indents much simpler. Hold down the Alt key as you select the
block.</I></P>
<P>
<BLOCKQUOTE>
<P>
<HR>
<strong>TIP:</strong> If you build Web pages and still use Notepad from time to time so
that you can see the tags, you're in for a pleasant surprise. Open an HTML file in
Developer Studio and see HTML syntax coloring in action. You'll never go back to
Notepad.
<HR>
</BLOCKQUOTE>
<H3><A NAME="Heading18"></A>Shortcut Menu</H3>
<P>Many of the actions you are likely to perform are available on the shortcut menu
that appears when you right-click within a file you are editing. The items on that
menu are as follows:</P>
<UL>
<LI><I>Cut</I>. Cuts the selected text to the Clipboard.
<P>
<LI><I>Copy</I>. Copies the selected text to the Clipboard.
<P>
<LI><I>Paste</I>. Replaces the selected text with the Clipboard contents, or if no
text is selected, inserts the Clipboard contents at the cursor.
<P>
<LI><I>Insert File Into Project</I>. Adds the file you are editing to the project
you have open.
<P>
<LI><I>Check Out.</I> If you're using Visual Source Safe, marks the file as being
changed by you.
<P>
<LI><I>Open</I>. Opens the file whose name is under the cursor. Especially useful
for header files because you don't need to know what folder they are in.
<P>
<LI><I>List members.</I> Lists the member variables and functions of the object under
the cursor.
<P>
<LI><I>Type Info.</I> Pops up a tip to remind you of the type of a variable or function.
<P>
<LI><I>Parameter Info. </I>Pops up a tip to remind you the parameters a function
takes.
<P>
<LI><I>Complete Word</I>. "Wakes up" AutoComplete to help with a variable
or function name that is partially typed.
<P>
<LI><I>Go To Definition</I>. Opens the file where the item under the cursor is defined
(header for a variable, source for a function) and positions the cursor at the definition
of the item.
<P>
<LI><I>Go To Reference</I>. Positions the cursor at the next reference to the variable
or function whose name is under the cursor.
<P>
<LI><I>Insert/Remove Breakpoint</I>. Inserts a breakpoint at the cursor or removes
one that is already there.
<P>
<LI><I>Enable Breakpoint</I>. Enables a disabled breakpoint (breakpoints are discussed
in Appendix D).
<P>
<LI><I>ClassWizard</I>. Opens ClassWizard.
<P>
<LI><I>Properties</I>. Opens the property sheet.
</UL>
<P>Not all the items are enabled at once--for example, Cut and Copy are only enabled
when there is a selection. Insert File into Project is enabled only when the file
you're editing is not in the project you have open. All these actions have menu and
toolbar equivalents and are discussed more fully later in this chapter.</P>
<P>
<H2><A NAME="Heading19"></A>Learning the Menu System</H2>
<P>Developer Studio has many menus. Some commands are three or four levels deep under
the menu structure. In most cases, there are far quicker ways to accomplish the same
task, but for a new user, the menus are an easier way to learn because you can rely
on reading the menu items as opposed to memorizing shortcuts. There are nine menus
on the Developer Studio menu bar, as follows:</P>
<UL>
<LI><I>File</I>. For actions related to entire files, such as opening, closing, and
printing.
<P>
<LI><I>Edit</I>. For copying, cutting, pasting, searching, and moving about.
<P>
<LI><I>View</I>. For changing the appearance of Developer Studio, including toolbars
and subwindows such as the Workspace window.
<P>
<LI><I>Insert</I>. For adding files or components to your project.
<P>
<LI><I>Project</I>. For dealing with your entire project.
<P>
<LI><I>Build</I>. For compiling, linking, and debugging.
<P>
<LI><I>Tools</I>. For customizing the Developer Studio and accessing standalone utilities.
<P>
<LI><I>Window</I>. To change which window is maximized or has focus.
<P>
<LI><I>Help</I>. To use the InfoViewer system (not the usual online help).
</UL>
<P>The following section presents each Developer Studio menu in turn and mentions
keyboard shortcuts and toolbar buttons where they exist.</P>
<P>
<H3><A NAME="Heading20"></A>Using the File Menu</H3>
<P>The File menu, shown in Figure C.18, collects most of the commands that affect
entire files or the entire project.</P>
<P><A HREF="javascript:popUp('xcuvc18.gif')"><B>FIG. C.18</B></A><B> </B><I>The File
menu has actions for files like Open, Close, and Print.</I></P>
<P><B>File New (Ctrl+N)  </B>Choosing this menu item opens the New dialog
box, shown in Figure C.19. This tabbed dialog box is used to create new files, projects,
workspaces, or other documents. The Project tab is used to start AppWizard, discussed
for the first time in Chapter 1, "Building Your First Windows Application."</P>
<P><A HREF="javascript:popUp('xcuvc19.gif')"><B>FIG. C.19</B></A><B> </B><I>The New
dialog box is used to create new files or workspaces.</I></P>
<P>This dialog box is an easy way to create a blank file, give it a name, and insert
it into your project all in one step.</P>
<P><B>File Open (Ctrl+O)  </B>Choosing this item opens the Open dialog
box, as shown in Figure C.20. (It's the standard Windows File Open dialog box, so
it should be familiar.) The file type defaults to Common Files with .C, .CPP, .CXX,
.TLI, .H, .TLH, .INL, or .RC extensions. By clicking the drop-down box, you can open
almost any kind of file, including executables and workspaces.</P>
<BLOCKQUOTE>
<P>
<HR>
<strong>TIP:</strong> Don't forget the list of recently opened files further down the File
menu. That can save a lot of typing or clicking.
<HR>
</BLOCKQUOTE>
<P><A HREF="javascript:popUp('xcuvc20.gif')"><B>FIG. C.20</B></A><B> </B><I>The familiar
File Open dialog box is used to open a variety of file types.</I></P>
<P><B>File Close  </B>Choosing the File, Close item closes the file that
has focus; if no file has focus, the item is grayed. You can also close a file by
clicking the cancel button, depicted by an X, in the top-right corner. You may also
close the window by double-clicking the icon in the upper-left corner. (The icon
used to be the system menu, shown with a minus on a button.)</P>
<P><B>File Open Workspace  </B>Use this item to open a workspace. (You
can use File, Open and change the file type to Project Workspaces, but using File,
Open Workspace is quicker.)</P>
<P><B>File Save Workspace  </B>Use this item to save a workspace and all
the files within it.</P>
<P><B>File Close Workspace  </B>Use this item to close a workspace. The
current workspace is closed automatically when you create a new project or open another
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -