---
title: "Visual Studio 2008 每日提示(十四)"
author: "cjc"
date: "2008-12-24T09:16:00Z"
tags: []
slug: "visual-studio-2008"
draft: false
lastmod: "2008-12-24T09:16:00Z"
id: 402673
url: "https://cjc.iteye.com/blog/402673"
---

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

本篇包括tip131-tip140  
[http://www.watch-life.net/visual-studio/visual-studio-2008-tip-day-14.html](http://www.watch-life.net/visual-studio/visual-studio-2008-tip-day-14.html)

## #131、你为什么会把窗体设置成为浮动（模式）

原文链接:[Why you would want to make a Tool Window Floating](http://blogs.msdn.com/saraford/archive/2008/01/17/did-you-know-why-you-would-want-to-make-a-tool-window-floating.aspx)

如果你想把工具窗体放在一个特定的区域，而不幸的是停靠目标显示了，这时候，如果设置窗口为浮动的，该窗体j将不会获得停靠目标，不会任何把任何工具窗体口作为停靠目标，不会把IDE的9个停靠位置多为停靠目标。

**评论：使用浮动窗口你可以自由停放窗口。**

## #132、从一组窗口中仅仅中止一个窗口的停靠（状态）

原文链接：[How to just undock a single tool window from a group](http://blogs.msdn.com/saraford/archive/2008/01/18/did-you-know-how-to-just-undock-a-single-tool-window-from-a-group.aspx)

**操作步骤**  
对于同时停靠一侧的多个非隐藏窗口，想只解除一个窗口的停靠，只需要拖动标签页就可以做到。

**评论：我觉得拖动的的方法很直观而迅速。**

## #133、通过工具窗口的标签（channel ）来显示自动隐藏的工具窗口

原文链接：[You can show auto-hiding Tool Windows via the Tool Window auto-hide channel](http://blogs.msdn.com/saraford/archive/2008/01/21/did-you-know-you-can-show-auto-hiding-tool-windows-via-the-tool-window-auto-hide-channel.aspx)

**操作步骤**  
对于隐藏的工具窗口，把光标放在工具窗口的标签（channel ）上就可以显示自动隐藏工具窗口，也可以工具窗口标签的右键菜单来选择显示自动隐藏的窗口。

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

**评论：右键菜单也许你没试过，不过把光标放在标签上来显示窗口你一定知道。**

## #134、让工具栏窗口停靠在IDE的顶部

原文链接：[You can dock a tool window to the top of the IDE](http://blogs.msdn.com/saraford/archive/2008/01/22/did-you-know-you-can-dock-a-tool-window-to-the-top-of-the-ide.aspx)

**操作步骤**  
拖动可停靠的窗口IDE的顶部停靠位置，把工具窗口停靠在IDE的顶部。这种停放的方式，在调试的模式下，你会发现“内存”窗口是这样停放的。

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

**评论：我还是比较喜欢把窗口都停靠在两侧或底部，这样IDE显得不那么拥挤。**

## #135、保存窗口的四种布局

原文链接：[There are 4 window layouts that you can save](http://blogs.msdn.com/saraford/archive/2008/01/23/did-you-know-there-are-4-window-layouts-that-you-can-save.aspx)

**操作步骤**  
窗口的四种布局模式：设计视图、全屏、调试模式、文件视图。  
保存方法如下  
菜单：**工具+导入和导出设置+导出**，然后选中“窗口布局”即可。

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

**评论：其实不止窗口布局，你可以把IDE的环境设置都可以保存。**

## #136、让工具栏浮动

原文链接：[you can make a toolbar floating](http://blogs.msdn.com/saraford/archive/2008/01/24/did-you-know-you-can-make-a-toolbar-floating.aspx)

**操作步骤**  
把光标放到工具栏左侧四个点的位置，光标就会变成“4个方向键”型

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

此时，左键按下并拖动工具栏，工具栏就会变成浮动状态。如下图所示  
![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/Didyouknow.youcanmakeatoolbarfloating_8496/CommandBarCustomizationsFloatingResize_thumb.jpg)

**评论： 这是典型OFFICE窗口的模式。**

## #137、在工具栏上隐藏或显示默认的按钮

原文链接：[You can hide or show the default buttons from any toolbar](http://blogs.msdn.com/saraford/archive/2008/01/25/did-you-know-you-can-hide-or-show-the-default-buttons-from-any-toolbar.aspx)

**操作步骤**  
点击工具栏的∨形标志弹出下拉菜单，选择“添加或移除按钮”，然后选者需要调整的工具栏名，在按钮列表中选中或不选中按钮。

![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/Didyouk.Youcandisplayanytoolbaratanytime_8E61/CommandBarCustomizationsDisplayAllToolbars_thumb.jpg)

**评论：把常用的按钮显示出来，很少用的就别选中了，这样让工具栏看起来简洁一些**

## #138、在任何时候显示任意工具栏

原文链接：[You can display any toolbar at any time](http://blogs.msdn.com/saraford/archive/2008/01/28/did-you-know-you-can-display-any-toolbar-at-any-time.aspx)

**操作步骤**  
右击工具栏的任意区域，从上下文（右键）菜单里，你可以选中任意一个工具栏，这个选中的工具栏就将会在任何时间显示。

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

**评论：把常用的按钮显示出来，既方便使用也让IDE的窗口显得不拥挤。**

## #139、在工具栏自定义对话框显示的时候，在工具栏改变交换按钮

原文链接：[you can switch and swap buttons on the toolbars while the Tools - Customize dialog is showing](http://blogs.msdn.com/saraford/archive/2008/01/29/did-you-know-you-can-switch-and-swap-buttons-on-the-toolbars-while-the-tools-customize-dialog-is-showing.aspx)

**操作步骤**  
右击工具栏的任意区域，从上下文（右键）菜单里，选择“自定义”，出现工具栏自定义对话框，由于该对话框是半模态窗体，这是你可以右键按住一个按钮，把它拖到另一个工具栏或者交换位置。

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

**评论：你可以新建一个工具栏，然后把自己常用的按钮拖进来，这个自定义的工具栏是不是很酷。**

## #140、定义上下文（右键）菜单的命令

原文链接：[You can customize the commands on the context menus](http://blogs.msdn.com/saraford/archive/2008/01/30/did-you-know-you-can-customize-the-commands-on-the-context-menus.aspx)

**操作步骤**  
菜单：**工具+自定义**，选者“**工具栏”**标签，选中“**上下文菜单**”项，在工具栏就会出现一些上下文菜单，比如：编辑器上下文菜单，类视图上下文菜单等等，你可以根据自己的需要来定义这些菜单。

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

**评论：通过这个定义，完全可以打造属于自己的上下文（右键）菜单**

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