---
title: "Visual Studio 2008 每日提示(十七)"
author: "cjc"
date: "2008-12-30T00:40:00Z"
tags: []
slug: "visual-studio-2008"
draft: false
lastmod: "2008-12-30T00:40:00Z"
id: 402669
url: "https://cjc.iteye.com/blog/402669"
---

&lt;script&gt;function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();}&lt;/script&gt;

本篇包括tip161-tip170  
[http://www.watch-life.net/visual-studio/visual-studio-2008-tip-day-17.html](http://www.watch-life.net/visual-studio/visual-studio-2008-tip-day-17.html)

## #161、在解决方案里显示（或不显示）编辑器中打开的文件

原文链接:[How to have the Solution Explorer always show (or not show) the file currently opened in the Editor](http://blogs.msdn.com/saraford/archive/2008/02/28/did-you-know-how-to-have-the-solution-explorer-always-show-or-not-show-the-file-currently-opened-in-the-editor-160.aspx)

**操作步骤：**  
菜单：**工具+选项+环境+常规**，选中“在解决方案管理器中显示活动项”则会在解决方案管理器中高亮显示打开的文件，反之不会显示。

![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/Did.HowtohavetheSolutionExploreralwayssh_F8F2/TrackActiveItemInSolutionExplorer_thumb.jpg)

**评论：也许你找就用这个功能了，只是没发现罢了**

## #162、返回Visual C++ 2.0的一些提示

原文链接:[A lot of tips go back to Visual C++ 2.0](http://blogs.msdn.com/saraford/archive/2008/02/29/did-you-know-a-lot-of-tips-go-back-to-visual-c-2-0-162.aspx)

本篇主要讲述一些Visual C++ 2.0的技巧，和vs2008似乎没什么关系。

**评论：不太明白vc++ 6.0 都过时了，为啥还搞vc++ 2.0 呢**

## #163、按 Ctrl+/ 转到Visual Studio命令行

原文链接: [You can press Ctrl+/ to reach the Visual Studio command line](http://blogs.msdn.com/saraford/archive/2008/03/03/did-you-know-you-can-press-ctrl-to-reach-the-visual-studio-command-line.aspx)

**操作步骤：**  
如何在不打开命令行窗口的时候，输入命令呢？可以按**Ctrl+/**，光标就会定位到查找的“**下拉组合框**”，同时在“下拉组合框”内会自动插入一个“&gt;”符号，在“&gt;”后面输入命令即可。

![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/Did.YoucanpressCtrltorunVisualStudiocomm_F8CE/CommandLineWindow_thumb.jpg)

**评论：这个功能很轻便，不需要打开命令行窗口**

## #164、在解决方案里不使用其他的工具窗口或对话框打开文件

原文链接:[How to open a file in the solution without using either a tool window or a dialog](http://blogs.msdn.com/saraford/archive/2008/03/04/did-you-know-how-to-open-a-file-in-the-solution-without-using-either-a-tool-window-or-a-dialog.aspx)

**操作步骤：**  
1、按**Ctrl+/**，光标就会定位到查找的“**下拉组合框**”。  
2、输入命令**File.OpenFile &lt;filename&gt;&lt;/filename&gt;**

如果你觉得**File.OpenFile &lt;filename&gt;&lt;/filename&gt;**太长了，可以给这个命令起一个别名，再用别名来打开文件

1、**Ctrl+/**  
2、输入**alias fo File.OpenFile**  
3、输入**fo &lt;filename&gt;&lt;/filename&gt;**

其中第二步，在以后打开文件的时候不需要再做了。

**评论：除了用鼠标点击来打开文件，这也是一种不错的选择，如果你对键盘操作很熟练的话。**

## #165、显示或不显示配置管理

原文链接:[How to pretend the configuration manager doesn't exist, besides closing your eyes and saying i don't see you](http://blogs.msdn.com/saraford/archive/2008/03/05/did-you-know-how-to-pretend-the-configuration-manager-doesn-t-exist-besides-closing-your-eyes-and-saying-i-don-t-see-you-165.aspx)

**操作步骤：**  
菜单：**工具+选项+环境+常规**，选中“显示高级生成配置”则会显示，反之不显示。

![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/Did.Howtopretendtheconfigurationmanagerd_F0A1/ShowAdvancedBuildConfig_thumb.jpg)

如果未选中，则所有有关配置管理的项都会隐藏

1、在标准工具栏不可用。  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/Did.Howtopretendtheconfigurationmanagerd_F0A1/ShowAdvancedBuildConfig3_thumb.jpg)

2、在解决方案和项目的右键菜单不可见  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/Did.Howtopretendtheconfigurationmanagerd_F0A1/ShowAdvancedBuildConfig4_thumb.jpg)

3、在项目属性里不显示

![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/Did.Howtopretendtheconfigurationmanagerd_F0A1/ShowAdvancedBuildConfig5_thumb.jpg)

**评论：有关配置管理更详细的内容可以参考msdn：[http://msdn.microsoft.com/zh-cn/library/8919d7f2.aspx](http://msdn.microsoft.com/zh-cn/library/8919d7f2.aspx)**

## #166、显示或隐藏“项目位置不受信任”的消息框

原文链接:[How to hide or show the "Project location is not trusted" message box](http://blogs.msdn.com/saraford/archive/2008/03/06/did-you-know-how-to-hide-or-show-the-project-location-is-not-trusted-message-box-166.aspx)

**操作步骤：**  
如果你在不受信任的路径上比如UNC （比如\\\\server\\folder）创建项目，就会有个提示，如下图

![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/Did.HowtohideorshowtheProjectlocationisn_FE2B/ProjectIsNotTrusted_thumb.jpg)

如果你想去掉这个消息，操作如下  
菜单：**工具+选项+环境+常规**，不选中“**项目位置不受信任警告用户**”即可。

**评论：我看还是选中的好，免得丢失创建好的项目**

## #167、在解决方案中止项目生成的组件自动填充工具箱

原文链接: [How to stop the Toolbox from auto-populating with items found in the solution](http://blogs.msdn.com/saraford/archive/2008/03/07/did-you-know-how-to-make-the-toolbox-not-automatically-populate-with-items-found-in-the-solution-167.aspx)

**操作步骤：**  
菜单：**工具+选项+windows窗体设计器+常规+工具箱**，设置“**AutoToolboxPopulate** ”为**false**

![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/Did.HowtomaketheToolboxnotautomaticallyp_10188/AutoPopulateToolbox_thumb.jpg)

这样设置以后就不把作为解决方案一部分一起编译的任何控件加载到工具箱的选项

**评论：在vs2005如果选了true会导致IDE假死，在vs2008已经修复了，你可以放心设置为true**

## #168、在生成的时候不显示输出窗口

原文链接:[How to stop the output window from showing itself during a build](http://blogs.msdn.com/saraford/archive/2008/03/10/did-you-know-how-to-stop-the-output-window-from-showing-itself-during-a-build-168.aspx)

**操作步骤：**  
菜单：**工具+选项+项目和解决方案+常规**，不选中“生**成时显示输出窗口**”

![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/Did.Howtostoptheoutputwindowfromshowingi_14F34/ShowOutputWindow2_thumb.jpg)

**评论：我觉得还是显示好，可以了解生成过程**

## #169、在解决方案方案重命名文件名时，自动重命名整个项目中引用的代码

原文链接:[You can have VS automatically do a rename within the entire project when you do a file rename in Solution Explorer](http://blogs.msdn.com/saraford/archive/2008/03/11/did-you-know-you-can-have-vs-automatically-do-a-rename-within-the-entire-project-when-you-do-a-file-rename-in-solution-explorer.aspx)

**操作步骤：**  
菜单：**工具+选项+项目和解决方案+常规**，选中“**重命名文件时提示符号重命名**”

![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/Did.YoucanhaveVSautomaticallydoarenamewi_4AD/PromptForSymbolicRename_thumb.jpg)

选中此项，则显示一个消息框，询问是否还应将项目中相应代码元素的所有引用重命名。

![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/Did.YoucanhaveVSautomaticallydoarenamewi_4AD/PromptForSymbolicRename2_thumb.jpg)

**评论：这功能不错，适合重构。**

## #170、用右键拖拽实现代码的复制和移动

原文链接:[You can Right-drag code to do a Move or a Copy](http://blogs.msdn.com/saraford/archive/2008/03/12/did-you-know-you-can-right-drag-code-to-do-a-move-or-a-copy-170.aspx)

**操作步骤：**  
选择一行代码，然后右拖拽到编辑器的任何位置（或到另一个编辑窗口） 。松开右键后会出弹出右键菜单，有三个选项“**移动到此处**”、“**复制到此处**”和“**取消**”。你可以根据需要来选择。

![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/Did.YoucanRightdragcodetodoaMoveoraCopy1_121E8/RighClickDrag_thumb.jpg)

**评论：这功能不错，以前一直不知道，如果用左键来拖拽的话，只能是移动。**

更多文章见：守望轩\[[http://www.watch-life.net](http://www.cnblogs.com/%E6%9B%B4%E5%A4%9A%E6%96%87%E7%AB%A0%E8%A7%81%EF%BC%9A%E5%AE%88%E6%9C%9B%E8%BD%A9%5Bhttp://www.watch-life.net/%5D)/]