Ale*_*gas 5 macros msdn visual-studio
我发现内置的Visual Studio Document Explorer不太相关,特别是因为我使用的更多SDK具有最新的在线内容.按F1启动文档资源管理器通常会有一些无用的东西,它对我来说不再可用.
在Visual Studio中按键组合时是否有任何方法:
site:msdn.microsoft.com
我对VS中的宏一无所知,但据推测这就是我需要的.有谁知道如何设置它?teh codez会很好!
这是另一个版本(基于Alex的答案),它还将选择您当前使用的单词.更像是典型的F1帮助.
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics
Public Module Search
Sub GoogleSearch()
AnySearch("http://www.google.com/search?q=.net+")
End Sub
Sub BingSearch()
AnySearch("http://www.bing.com/search?q=")
End Sub
Private Sub AnySearch(ByVal searchUrl)
Dim strUrl As String
Dim selection As String = GetSelection()
If selection <> "" Then
strUrl = searchUrl + selection
DTE.ExecuteCommand("nav", strUrl & " /ext")
Else
MsgBox("Select text to search for.")
End If
End Sub
Private Function GetSelection() As String
Dim selection As TextSelection = DTE.ActiveDocument.Selection()
If selection.Text <> "" Then
Return selection.Text
Else
DTE.ExecuteCommand("Edit.SelectCurrentWord")
selection = DTE.ActiveDocument.Selection()
Return selection.Text
End If
End Function
End Module
Run Code Online (Sandbox Code Playgroud)