3

Visual Studio 2008 Team Edition を使用して、マークアップとコードを切り替えるショートカット キーを割り当てることはできますか? そうでない場合、コードからマークアップへのショートカット キーを割り当てることは可能ですか?

4

2 に答える 2

4

以下は、 https: //blog.codinghorror.com/visual-studio-net-2003-and-2005-keyboard-shortcuts/ の Lozza によるコメントから取られたマクロです。選択したショートカットにバインドするだけです。

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
于 2008-09-23T08:40:44.820 に答える
1

私は自分で ASPX 開発を行っていないので、これがあなたの言いたいことかどうかわかりませんが、F7 (コードを表示) と Shift-F7 (デザイナーを表示) の既定のキー バインディングは、コードとデザインを切り替えませんか? 私の VS2008 (WinForms のデザイン可能なアイテム) では、私が使用するほとんどデフォルトの C# キー バインディングを使用します。

于 2010-08-12T10:24:13.830 に答える