【问题标题】:Visual Studio macro: Get path of previous/next documentVisual Studio 宏:获取上一个/下一个文档的路径
【发布时间】:2011-05-28 14:57:20
【问题描述】:

如何在标签栏上获取上一个活动文档和上一个/下一个文档的路径?

'Get current active document
Dim file1 As String = DTE.ActiveDocument.FullName

'Get previous active document
Dim file2 As String = 

'Get previous/next document (position on tab bar)
Dim file3 As String = 

谢谢。

【问题讨论】:

    标签: visual-studio visual-studio-2010 macros


    【解决方案1】:

    不确定这是否是最好的方法,但我想出使用以下代码在标签栏上获取上一个/下一个文档:

        Dim activeDocument As String = DTE.ActiveDocument.FullName
        Dim nextDocument As String
    
        'Get next document
        Dim found As Boolean = False
        Dim i As Integer
        For i = 1 To DTE.Windows.Count Step 1
            If DTE.Windows().Item(i).Kind = "Document" Then
                If DTE.Windows().Item(i) Is DTE.ActiveWindow Then
                    found = True
                ElseIf found Then
                    nextDocument = DTE.Windows().Item(i).Document.FullName
                    Exit For
                End If
            End If
        Next
    

    但不确定如何获取上一个活动文档。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-12-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多