切换标题/源的宏?专注于下一个标签组? [英] Macro for toggle header/source? focus on next tab group ?
本文介绍了切换标题/源的宏?专注于下一个标签组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有Visual Studio 2005,并且需要一些宏用于
o切换源/标题
o专注于下一个选项卡组
它们是否已经存在于某处在msdn上?
I have visual studio 2005 and need some macros for
o Toggle Source / Header
o Focus on next tab group
Do they exist already somewhere on the msdn?
推荐答案
这是我正在使用的宏,
Here is the macro I'm using,
<表格样式=" border-width:0px;边距:2px 0px;宽度:99%; border-collapse:collapse; background-color:rgb(255,255,255)"cellpadding = 0 cellspacing = 0> ToggleHeader() 暗 activeDocument 为 文档 activeDocument = DTE.ActiveDocument 如果 是 没有了 然后 退出 子 结束 > 如果 昏暗 sActiveDocument As 字符串 如果 InStr(sActiveDocument, " .h" ) 然后 '是头文件 OpenSourceFile(LCase(sActiveDocument)) blue>其他 如果 InStr(sActiveDocument, " .cpp" ) 然后 '是源文件 > OpenHeaderFile(LCase(sActiveDocument)) /font> > 结束 如果 结束 如果 私有 Sub ByVal 为 String ) 暗 projectItem 为 ProjectItem 暗 activeSourceFile As 字符串 > ,activeDoc.Length-2)+ .cpp"" > >如果 projectItem 是 " ; No Sourcefile'' ) 退出 Sub 结束 如果 如果 projectItem.IsOpen(Constants.vsViewKindCode)= False 然后 其他 -color:rgb(247,247,247)> style ="font-size:11px"> Sub 子 OpenHeaderFile( ByVal activeDoc > 为 字符串 ) projectItem ProjectItem 暗 As <字体样式="font-size:11px"> 字符串 4)+ " .h" > projectItem = DTE.Solution.FindProjectItem(activeSourceFile) 如果 projectItem 是 :11px>) 退出 子 > 结束 如果 如果 projectItem.IsOpen(Constants.vsViewKindCode)= 其他 tr> > ItemItem.Document.Activate() color:blue>结束 如果 子
Sub ToggleHeader() |
Dim activeDocument As Document |
activeDocument = DTE.ActiveDocument |
If activeDocument Is Nothing Then |
Exit Sub |
End If |
Dim sActiveDocument As String |
sActiveDocument = activeDocument.FullName |
If InStr(sActiveDocument, ".h") Then ' is a header file |
OpenSourceFile(LCase(sActiveDocument)) |
Else |
If InStr(sActiveDocument, ".cpp") Then ' is a source file |
OpenHeaderFile(LCase(sActiveDocument)) |
Else |
'nothing to do |
End If |
End If |
End Sub |
Private Sub OpenSourceFile(ByVal activeDoc As String) |
Dim projectItem As ProjectItem |
Dim activeSourceFile As String |
activeSourceFile = Left(activeDoc, activeDoc.Length - 2) + ".cpp" |
projectItem = DTE.Solution.FindProjectItem(activeSourceFile) |
If projectItem Is Nothing Then |
MsgBox("No Source file") |
Exit Sub |
End If |
If projectItem.IsOpen(Constants.vsViewKindCode) = False Then |
projectItem.Open(Constants.vsViewKindCode).Activate() |
Else |
projectItem.Document.Activate() |
End If |
End Sub |
Private Sub OpenHeaderFile(ByVal activeDoc As String) |
Dim projectItem As ProjectItem |
Dim activeSourceFile As String |
activeSourceFile = Left(activeDoc, activeDoc.Length - 4) + ".h" |
projectItem = DTE.Solution.FindProjectItem(activeSourceFile) |
If projectItem Is Nothing Then |
MsgBox("No Header file") |
Exit Sub |
End If |
If projectItem.IsOpen(Constants.vsViewKindCode) = False Then |
projectItem.Open(Constants.vsViewKindCode).Activate() |
Else |
projectItem.Document.Activate() |
End If |
End Sub |
这篇关于切换标题/源的宏?专注于下一个标签组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取
|
15天全站免登陆