---
title: "Visual Studio 2008 每日提示(五)"
author: "cjc"
date: "2008-12-10T15:33:00Z"
tags: []
slug: "visual-studio-2008"
draft: false
lastmod: "2008-12-10T15:33:00Z"
id: 402683
url: "https://cjc.iteye.com/blog/402683"
---

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

本篇包括tip41-tip50  
[http://www.watch-life.net/visual-studio/visual-studio-2008-tip-day-5.html](http://www.watch-life.net/visual-studio/visual-studio-2008-tip-day-5.html)

## #041、 通过返回标记，在编辑器向前或向后定位代码

原文地址：[http://blogs.msdn.com/saraford/archive/2007/09/19/did-you-know-how-to-navigate-forward-and-backwards-in-the-editor-all-because-of-go-back-markers.aspx](http://blogs.msdn.com/saraford/archive/2007/09/19/did-you-know-how-to-navigate-forward-and-backwards-in-the-editor-all-because-of-go-back-markers.aspx)

**操作步骤：**  
1、使用标准工具栏的“**向前定位**”和“**向后定位**”按钮。

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

2、快捷键：向后定位是“**Ctrl+-**(减号)”,向前定位是“**Ctrl+Shift+-**（减号）”。这些命令在浏览多个文件或在调试堆栈非常有用。

评论：这个功能非常实用，你可以在一个文件里非常方便地定位代码，值得你花点时间去研究一下，具体你可以参考一下原文

## #042、 什么情况下文档标签栏的下拉图标会变化

原文地址：[http://blogs.msdn.com/saraford/archive/2007/09/19/pop-quiz-under-what-condition-does-the-file-tab-channel-drop-down-button-change-its-icon.aspx](http://blogs.msdn.com/saraford/archive/2007/09/19/pop-quiz-under-what-condition-does-the-file-tab-channel-drop-down-button-change-its-icon.aspx)

**操作步骤：**  
下图是文档标签栏，红色圆圈处下拉图标是个“箭头”

![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/testdraft_C236/image_thumb_1.png)

如果同时打开了很多文件，标签很多放不下一屏的时候，图标就会变成下面这样

![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/testdraft_C236/image_thumb_2.png)

评论：这个图标的变化你发现了么？

## #043、 选择退回上一步的代码

原文地址：[http://blogs.msdn.com/saraford/archive/2007/09/20/did-you-know-ctrl-selects-code-to-the-last-go-back-marker.aspx](http://blogs.msdn.com/saraford/archive/2007/09/20/did-you-know-ctrl-selects-code-to-the-last-go-back-marker.aspx)

**操作步骤：**  
快捷键“**Ctrl+=** ”可以选择至上个后退标记的代码。

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

评论：作者对快捷键的研究真细致呀

## #044、单词的向前删除和向后删除

原文地址：[http://blogs.msdn.com/saraford/archive/2007/09/21/did-you-know-ctrl-delete-deletes-the-preceding-word-and-ctrl-backspace-deletes-the-proceeding-word.aspx](http://blogs.msdn.com/saraford/archive/2007/09/21/did-you-know-ctrl-delete-deletes-the-preceding-word-and-ctrl-backspace-deletes-the-proceeding-word.aspx)

**操作步骤：**  
1、向后删除：**Ctrl+Delete** ，从光标处向后删除到单词结束  
2、向前删除：**Ctrl+Backspace**，从光标处向前删除到单词开始

评论：这个功能值得推荐，可以很快速的删除一个单词或一部分字符

## #045、将光标移到文档当前视图的顶部或底部（无需滚动）

原文地址：[http://blogs.msdn.com/saraford/archive/2007/09/24/did-you-know-how-to-up-to-the-top-and-bottom-of-the-current-view-in-the-editor-without-scrolling.aspx](http://blogs.msdn.com/saraford/archive/2007/09/24/did-you-know-how-to-up-to-the-top-and-bottom-of-the-current-view-in-the-editor-without-scrolling.aspx)

**操作步骤：**  
1、**Ctrl+PageUp**：将光标移至当前文档视图的顶部，并非移动当前视图（如果使用**PageUp**则光标会移动当前文档的顶部）。

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

2、**Ctrl+PageDown**：将光标移至当前文档视图的底部，并非移动当前视图（如果使用**PageDown**则光标会移动当前文档的底部）。

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

3、**Ctrl+Shift+PageUp**：选中光标移至当前文档视图顶部的代码。

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

4、**Ctrl+Shift+PageDown**：选中光标移至当前文档视图底部的代码。

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

评论：就是在不滚动视图的情况下来，来定位光标或选中代码。

## #046、快捷方式剪切和删除当前行

原文地址：[http://blogs.msdn.com/saraford/archive/2007/09/25/did-you-know-ctrl-l-cuts-the-current-line-and-ctrl-shift-l-deletes-the-current-line.aspx](http://blogs.msdn.com/saraford/archive/2007/09/25/did-you-know-ctrl-l-cuts-the-current-line-and-ctrl-shift-l-deletes-the-current-line.aspx)

**操作步骤：**  
1、**Ctrl+X**：剪切当前行。（原文是Ctrl+L）  
2、**Ctrl+Shift+L**：删除当前行。

评论：这两个快捷功能，我最喜欢了，不必手动选择一行，只要把把光标放在一行的任意位置就可以实现剪切和删除

## #047、在选中代码段交换光标的位置

原文地址：[http://blogs.msdn.com/saraford/archive/2007/09/26/did-you-know-how-to-swap-the-current-anchor-position-in-the-editor.aspx](http://blogs.msdn.com/saraford/archive/2007/09/26/did-you-know-how-to-swap-the-current-anchor-position-in-the-editor.aspx)

**操作步骤：**  
快捷键**Ctrl+K, Ctrl+A**，让光标的位置选中代码段的开始和结束之间交换。

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

评论：这个功能倒是用的比较少

## #048、在标准工具栏上使用撤销

原文地址：[http://blogs.msdn.com/saraford/archive/2007/09/27/did-you-know-how-to-use-the-undo-stack-on-the-standard-toolbar.aspx](http://blogs.msdn.com/saraford/archive/2007/09/27/did-you-know-how-to-use-the-undo-stack-on-the-standard-toolbar.aspx)

**操作步骤：**  
当光标在编辑器中时，你会在标准工具栏里发现“**撤销**”和“**重复**”的按钮。

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

通过快捷键**Ctrl-Z** 或 **Ctrl-Y** 你可以撤销或重复你做过的所有动作。你也可以通过点击“**撤销**”和“**重复**”按钮旁边的下拉箭头来实现。

评论：你可以返回到曾经的每一步操作。

## #049、在书籍里面没有Ctrl+F

原文地址：[http://blogs.msdn.com/saraford/archive/2007/09/27/useless-tip-of-the-day-there-is-no-ctrl-f-in-books.aspx](http://blogs.msdn.com/saraford/archive/2007/09/27/useless-tip-of-the-day-there-is-no-ctrl-f-in-books.aspx)

当我们阅读书籍的时候，要是也可以通过**Ctrl+F**来查找就好了。

评论：这tip作者啥也没写。作者自己也说：Useless Tip of the Day

## #050、避免意外复制空行

原文地址：[http://blogs.msdn.com/saraford/archive/2007/09/27/useless-tip-of-the-day-there-is-no-ctrl-f-in-books.aspx](http://blogs.msdn.com/saraford/archive/2007/09/27/useless-tip-of-the-day-there-is-no-ctrl-f-in-books.aspx)

**操作步骤：**  
当粘贴一段代码到一个新的位置的时候，如果使用的是**Ctrl+C**而不是**Ctrl+V**，当你发现按错了，再次按**Ctrl+V**，结果复制的是空行。如何避免这种情况的出现呢？可以进行如下设置:  
菜单：**工具+选项+文本编辑器+所有语言**，不勾选“**没有选定内容时对空行应用剪切或复制命令**”。  
清除此选项时，“剪切”命令将移除空行。但仍保留剪贴板中的数据。因此，如果随后使用“粘贴”命令，则会粘贴最近复制到剪贴板的内容。如果先前没有复制任何内容，则不会粘贴任何内容。

![](http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/Didyo.hownottoaccidentallycopyablankline_AC07/CutCopyBlankLine_thumb.jpg)

评论：使用这个功能就可以避免粘贴空行了。

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