---
title: "Visual Studio 2008 每日提示(二十)"
author: "cjc"
date: "2009-01-04T00:31:00Z"
tags: []
slug: "visual-studio-2008"
draft: false
lastmod: "2009-01-04T00:31:00Z"
id: 402667
url: "https://cjc.iteye.com/blog/402667"
---

&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;

本篇包括tip191-tip200  
[http://www.watch-life.net/visual-studio/visual-studio-2008-tip-day-20.html](http://www.watch-life.net/visual-studio/visual-studio-2008-tip-day-20.html%20)

## #191、把代码拖拽到工具箱的常规选项卡

原文链接:[drag and drop code onto the Toolbox General tab](http://blogs.msdn.com/saraford/archive/2008/04/10/did-you-know-you-can-drag-and-drop-code-onto-the-toolbox-general-tab-191.aspx)

**操作步骤：**  
在工具箱有个**常规选项卡**

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

你可以选中一段代码，拖拽到常规选项卡里面，如下图所示

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

**评论：这个功能不错，我一般将一些常规的头注释等都放到这里。拖拽进去后，你可以重命名。等需要的时候可以从工具栏拖拽到文本编辑器里面。同时你不一定在常规选项卡里放拖拽的文本，也可以在其他选项卡放，或者直接建一个选项卡放，同时把工具箱的配置文件toolbox.tbd（位于C:\\Documents and Settings\\Administrator\\Local Settings\\Application Data\\Microsoft\\VisualStudio\\9.0）备份起来，让这个配置文件在每个vs环境下可以通用。**

## #192、用Ctrl+C和Ctrl+V 粘贴控件到其他工具箱选项卡

原文链接：[You can Ctrl+C copy and Ctrl+V paste controls into other Toolbox tabs](http://blogs.msdn.com/saraford/archive/2008/04/11/did-you-know-you-can-ctrl-c-copy-and-ctrl-v-paste-controls-into-other-toolbox-tabs-192.aspx)

**操作步骤：**  
1、你用鼠标**拖拽**把控件移动新的选项卡，也可以用**Shirft+拖拽**把控件复制粘贴到新的选项卡。

2、用**Ctrl+C**复制任一控件，然后用**Ctrl+V** 粘贴到新的选项卡。

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

## #193、创建新的工具箱选项卡

原文链接：[You can create new Toolbox tabs](http://blogs.msdn.com/saraford/archive/2008/04/14/did-you-know-you-can-create-new-toolbox-tabs-193.aspx)

**操作步骤：**  
你可以根据自己的需要创建新的工具箱选项卡，比如你可以把自己创建的空间放到你定义的工具箱里，创建的方法，右击工具箱，从右键菜单选择“**添加选项卡**”，给新创建的选项卡起的名称。把你需要的控件放在里面。

![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/Didyouknow.YoucancreatenewToolboxtabs_F47E/ToolboxAddTab_thumb.jpg)

或者把自己的写的代码也拖拽进去

![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/Didyouknow.YoucancreatenewToolboxtabs_F47E/ToolboxNewTab_thumb.jpg)

**评论：你可以按自己的要求新建或整理工具箱.**

## #194、在输出窗口启用自动换行

原文链接：[You can enable Word Wrap in the Output Window](http://blogs.msdn.com/saraford/archive/2008/04/15/did-you-know-you-can-enable-word-wrap-in-the-output-window-194.aspx)

**操作步骤：**  
在输出窗口的工具栏右侧有个“切换到自动换行”的图标按钮，点击后将启动自动换行。

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

设置自动换行前  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/Did.YoucanenableWordWrapintheOutputWindo_FD1A/OutputWindowBeforeWordWrap_thumb_1.jpg)

设置自动换行后

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

**评论：这功能不错，免得拖动滚动条了.**

## #195、在输出窗口双击消息跳转到代码的位置

原文链接：[you can double-click messages in the Output Window to jump to that location in the code](http://blogs.msdn.com/saraford/archive/2008/04/16/did-you-know-you-can-double-click-messages-in-the-output-window-to-jump-to-that-location-in-the-code-195.aspx)

**操作步骤：**  
在输出窗口双击错误或警告消息，会自动跳转到文件中的该位置（错误行或警告行）。

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

也可以点击输出窗口的工具栏上“在代码中查找消息”按钮图标，跳转到该位置。

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

**评论：双击跳转恐怕不知道人不多吧，不过还可以通过单击那个图标按钮实现这个功能恐怕你没注意吧？**

## #196、自定义输出窗口的配色方案

原文链接：[You can customize the color scheme in the Output Window](http://blogs.msdn.com/saraford/archive/2008/04/17/did-you-know-you-can-customize-the-color-scheme-in-the-output-window-196.aspx)

**操作步骤：**  
菜单：**工具+选项+环境+字体和颜色**，在“**显示其设置**”下拉框里选择“**输出窗口**”，然后在“显示项”里根据的喜好来定义：纯文本，选定的文本，非活动的选定文本，当前列表位置 等4项的颜色

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

比如设定“选定的文本”项背景为灰色，效果如下

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

**评论：不但输出窗口，很多窗口都可以这样设置。**

## #197、在输出窗口按F8或Shift+F8在错误信息中跳转

原文链接：[You can use F8 and Shift+F8 to navigate among errors in the output window](http://blogs.msdn.com/saraford/archive/2008/04/18/did-you-know-you-can-use-f8-and-shift-f8-to-navigate-among-errors-in-the-output-window.aspx)

**操作步骤：**  
在输出窗口按**F8**跳转到下一个（错误 或警告）信息，按**Shift+F8**上一（错误 或警告）信息

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

**评论：如果你习惯鼠标，可以用鼠标双击来实现。**

## #198、重定向调试信息到输出窗口

原文链接：[You can redirect debug messages to the output window](http://blogs.msdn.com/saraford/archive/2008/04/21/did-you-know-you-can-redirect-debug-messages-to-the-output-window.aspx)

**操作步骤：**  
如果你想把有关调试信息在“**即时窗口**”显示，设置如下：

菜单：**工具+选项+调试+常规**，选中“将所有输出窗口的文本重定向到即时窗口”

![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucanredirectdebugmessagestot_11C6D/OutputWindowRedirectImmediate_thumb.jpg)

选中该项后，所有调试信息不会再在输出窗口显示了。

![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucanredirectdebugmessagestot_11C6D/OutputWindowRedirectImmediate2_thumb.jpg)

**评论：你用过很长的时间的vs，也许从没发现这个设置吧。在输出窗口显示的信息太多了，在即时窗口显示调试信息，显然更清晰。**

## #199、在输出窗口为什么不能启用“停止搜索”？

原文链接：[You cannot enable the “stop search” on the Output Window](http://blogs.msdn.com/saraford/archive/2008/04/22/did-you-know-you-cannot-enable-the-stop-search-on-the-output-window.aspx)

作者在输出窗口发现了“**停止搜索**”的命令，想起用它，不过她花了20分钟都没找到，只要求助开发人员。

显然，这个功能是应该被隐藏的，因为**输出窗口**和**查找结果窗口**是共享很多的执行结果的。

**评论：不是作者提醒，我根本在意有这个细节的地方。**

## #200、在“错误列表”给“错误”、“警告”、“消息”按钮绑定快捷键

原文链接：[You can bind the show “Errors”, “Warnings”, and “Messages” buttons to keyboard shortcuts](http://blogs.msdn.com/saraford/archive/2008/04/23/did-you-know-you-can-bind-the-show-errors-warnings-and-messages-buttons-to-keyboard-shortcuts.aspx)

**操作步骤：**  
绑定过程很简单，在菜单：**工具+选项+环境+键盘**，进行绑定就可以了，只是这三个按钮对应的命令是：错误、警告、消息。而不是通常有两个单词构成（word.word）,比如：**视图.下一任务**。(为此作者还特意联络开发人员确认)  
至于绑定什么快捷键，你可以根据的喜好来做。

![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/DidyouknowYoucanbindtheshowErrorsWarning_126FD/ErrorListButtonsKeyboardShortcuts2_thumb.jpg)

**评论：嗯，作者对vs测试做的非常细致，并及时把自己不明白的地方和开发人员沟通。**

更多文章见：守望轩\[http://www.watch-life.net/]