2008-09-23 72 views

回答

4

以下是从Lozza对http://www.codinghorror.com/blog/archives/000315.html的评论中获取的宏。你只需将其绑定到您选择的快捷键:

Sub SwitchToMarkup() 
    Dim FileName 

    If (DTE.ActiveWindow.Caption().EndsWith(".cs")) Then 
    ' swith from .aspx.cs to .aspx 
    FileName = DTE.ActiveWindow.Document.FullName.Replace(".cs", "") 
    If System.IO.File.Exists(FileName) Then 
     DTE.ItemOperations.OpenFile(FileName) 
    End If 
    ElseIf (DTE.ActiveWindow.Caption().EndsWith(".aspx")) Then 
    ' swith from .aspx to .aspx.cs 
    FileName = DTE.ActiveWindow.Document.FullName.Replace(".aspx", ".aspx.cs") 
    If System.IO.File.Exists(FileName) Then 
     DTE.ItemOperations.OpenFile(FileName) 
    End If 
    ElseIf (DTE.ActiveWindow.Caption().EndsWith(".ascx")) Then 
    FileName = DTE.ActiveWindow.Document.FullName.Replace(".ascx", ".ascx.cs") 
    If System.IO.File.Exists(FileName) Then 
     DTE.ItemOperations.OpenFile(FileName) 
    End If 
    End If 
End Sub 
1

不知道这是你的意思,因为我没有做ASPX发展自己,但不要将F7(显示代码)和Shift-F7(show designer)默认的键绑定在代码和设计之间切换?他们在我的VS2008中(在WinForms可设计项目上)使用我使用的大部分默认的C#键绑定。

+0

它们在设计器(wysiwyg)和代码视图之间切换,但不是标记视图。顺便说一下,我觉得这特别烦人。 – 2010-08-12 11:51:49

相关问题