visual-studio Visual Studio (2005-2010) 的隐藏功能?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/100420/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 16:32:52  来源:igfitidea点击:

Hidden Features of Visual Studio (2005-2010)?

visual-studiotext-editorhidden-features

提问by shoosh

Visual Studio is such a massively big product that even after years of working with it I sometimes stumble upon a new/better way to do things or things I didn't even know were possible.

Visual Studio 是一个如此庞大的产品,即使经过多年的使用,我有时也会偶然发现一种新的/更好的方法来做一些我什至不知道是可能的事情。

For instance-

例如-

  • Crtl+ R, Ctrl+ Wto show white spaces. Essential for editing Python build scripts.

  • Under "HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\Text Editor"Create a String called Guideswith the value "RGB(255,0,0), 80" to have a red line at column 80 in the text editor.

  • Crtl+ R, Ctrl+W显示空格。编辑 Python 构建脚本必不可少。

  • "HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\Text Editor"创建名为Guides且值为“RGB(255,0,0), 80”的字符串下,在文本编辑器的第 80 列处有一条红线。

What other hidden features have you stumbled upon?

您还发现了哪些其他隐藏功能?

回答by shoosh

Make a selection with ALT pressed - selects a square of text instead of whole lines.

按下 ALT 进行选择 - 选择一个正方形的文本而不是整行。

回答by Charles Anderson

Tracepoints!

跟踪点!

Put a breakpoint on a line of code. Bring up the Breakpoints Window and right click on the new breakpoint. Select 'When Hit...'. By ticking the 'Print a message' check box Visual Studio will print out a message to the Debug Output every time the line of code is executed, rather than (or as well as) breaking on it. You can also get it to execute a macro as it passes the line.

在一行代码上放置一个断点。打开 Breakpoints 窗口并右键单击新的断点。选择“命中时...”。通过勾选“打印消息”复选框,Visual Studio 将在每次执行代码行时向调试输出打印一条消息,而不是(或同时)中断它。您还可以让它在通过该行时执行宏。

回答by jfs

You can drag code to the ToolBox. Try it!

您可以将代码拖到工具箱中。尝试一下!

回答by Craig

Click an identifier (class name, variable, etc) then hit F12for "Go To Definition". I'm always amazed how many people I watch code use the slower right-click -> "Go To Definition" method.

单击标识符(类名、变量等),然后单击F12“转到定义”。我总是很惊讶有多少人使用较慢的右键单击->“转到定义”方法观看代码。

EDIT:Then you can use Ctrl+-to jump back to where you were.

编辑:然后您可以使用Ctrl+-跳回到您所在的位置。

回答by sontek

CTRL+SHIFT+V will cycle through your clipboard, Visual Studio keeps a history of copies.

CTRL+SHIFT+V 将循环浏览您的剪贴板,Visual Studio 会保留副本的历史记录。

回答by Aaron Powell

Sara Ford covers lots of lovely tips: http://blogs.msdn.com/saraford/archive/tags/Visual+Studio+2008+Tip+of+the+Day/default.aspx

Sara Ford 涵盖了许多可爱的提示:http: //blogs.msdn.com/saraford/archive/tags/Visual+Studio+2008+Tip+of+the+Day/default.aspx

But some of my favourites are Code Snippets, Ctrl+ .to add a using<Namespace> or generate a method stub. I can't live without that.

但我最喜欢的是代码片段,Ctrl+.添加using<Namespace> 或生成方法存根。没有它我就活不下去。

Check out a great list in the Visual Studio 2008 C# Keybinding poster: http://www.microsoft.com/downloadS/details.aspx?familyid=E5F902A8-5BB5-4CC6-907E-472809749973&displaylang=en

查看 Visual Studio 2008 C# Keybinding 海报中的一个很棒的列表:http: //www.microsoft.com/downloadS/details.aspx?familyid=E5F902A8-5BB5-4CC6-907E-472809749973&displaylang=en

回答by Mark Glorie

CTRL-K, CTRL-D

Reformat Document!
This is under the VB keybindings, not sure about C#

重新格式化文件!
这是在 VB 键绑定下,不确定 C#

回答by tenpn

How many times do you debug an array in a quickwatch or a watch window and only have visual studio show you the first element? Add ",N" to the end of the definition to make studio show you the next N items as well. IE "this->m_myArray" becomes "this->m_array,5".

您在 quickwatch 或 watch 窗口中调试数组多少次并且只让 Visual Studio 向您显示第一个元素?将“,N”添加到定义的末尾,使工作室也向您显示接下来的 N 项。IE "this->m_myArray" 变成 "this->m_array,5"。

回答by Leyu

Incremental search: While having a source document open hit (CTRL + I) and type the word you are searching for you can hit (CTRL + I) again to see words matching your input.

增量搜索:在打开源文档时点击 (CTRL + I) 并输入您要搜索的单词,您可以再次点击 (CTRL + I) 以查看与您的输入匹配的单词。

回答by Ferruccio

You can use the following codes in the watch window.

您可以在监视窗口中使用以下代码。

@err - display last error
@err,hr - display last error as an HRESULT
@exception - display current exception