Visual Studio의 제목 표시 줄 텍스트를 변경하는 방법
우리는 동일한 코드의 여러 가지 브랜치에서 작업하며 두 브랜치에서 동시에 작업 할 때 혼란스럽고 시간 낭비가 될 수 있습니다.
현재 VS 제목 표시 줄에는 <solution-name> - Visual Studio
.
그 텍스트를 만드는 확장을 작성할 수 <solution-name>: <branch-name> - <Visual Studio>
있습니까?
방금 도움이 될 수있는 작은 Visual Studio 확장 프로그램을 만들었습니다. http://visualstudiogallery.msdn.microsoft.com/f3f23845-5b1e-4811-882f-60b7181fa6d6
이 작은 확장은 Visual Studio의 두 인스턴스가 실행될 때마다 감지하고 솔루션의 상위 폴더 이름을 포함하도록 Visual Studio의 창 제목을 변경합니다. 따라서 SolutionFolder-Microsoft Visual Studio 를 SolutionFolderParent \ SolutionFolder-Microsoft Visual Studio로 변경 합니다.
이것은 솔루션을 분기 할 때 특히 유용합니다. 둘 다 동일한 솔루션 이름을 갖는 경우 작업중인 분기를 쉽게 식별 할 수 있습니다.
공식 페이지 : http://erwinmayer.com/labs/visual-studio-2010-extension-rename-visual-studio-window-title/
VSCommands 2010 Lite 의 최신 릴리스를 확인하십시오 . 폴더 구조에서 분기 이름을 추출하고 Visual Studio 주 창 제목에 배치하도록 정규식 패턴을 설정할 수있는 Friendly Solution Name이라는 기능이 도입되었습니다. 자세한 내용 : http://vscommands.com/releasenotes/3.6.8.0 및 http://vscommands.com/releasenotes/3.6.9.0
MainWindow.Caption을 설정하려고하면 예외가 발생합니다. 제목을 변경하려면 Win32 SetWindowText 함수를 사용해야하지만주의해야합니다. Visual Studio는 모자 드롭에서 제목 표시 줄 텍스트를 다시 설정하므로 원하는 텍스트를 계속 설정하려면 타이머를 구현해야합니다. Connect
추가 기능 클래스의 다음 코드 는 영구적으로 (또는 추가 기능이 실행되는 동안) 제목 표시 줄 텍스트를 "Hello World!"로 유지합니다.
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
_applicationObject = (DTE2)application;
_addInInstance = (AddIn)addInInst;
resetTitleTimer = new Timer(new TimerCallback(SetMainWindowTitle), "Hello world!", 0, 10);
}
[DllImport("user32.dll")]
private static extern bool SetWindowText(IntPtr hWnd, string lpString);
private void SetMainWindowTitle(object state)
{
IntPtr hWnd = (IntPtr)_applicationObject.MainWindow.HWnd;
SetWindowText(hWnd, "Hello World!");
}
솔루션 파일을 대상으로하는 다른 이름의 심볼릭 링크를 추가했습니다. 심볼릭 링크가있는 솔루션을 열고 창 제목에 심볼릭 링크 이름이 있습니다.
Windows에서 : mklink BlawBranch.sln Blaw.sln
편집 : 대상 .sln 파일이 소스 제어에 의해 업데이트되면 하드 링크가 끊어지는 것을 발견했습니다. 심볼릭 링크에는 동일한 문제가 없습니다.
Visual Studio 제목 표시 줄을 표현식으로 정의하여 변경하는 또 다른 확장 : http://visualstudiogallery.msdn.microsoft.com/2e8ebfe4-023f-4c4d-9b7a-d05bbc5cb239
"제목 표현"을 사용하는 설정은이 플러그인을 매우 유연하게 만듭니다.
솔직히 말해서 귀하의 질문을 올바르게 이해하고 있는지 확실하지 않지만 비슷한 문제에 관한 것 같습니다.
동일한 Visual Studio 2005 솔루션의 다른 버전 / 분기로 작업
아마도 더 간단한 해결책은 가상 데스크톱을 사용하는 것입니까? 공간 배치는 기억하기 더 쉽고 관련 창을 해당 VS로 그룹화 할 수 있으며 전환이 더 간단합니다.
Visual Studio 기반 IDE에 대해 AppName이라는 이름의 속성이 있습니다.
에서 http://www.helixoft.com/blog/archives/32 현재 파일 이름에 제목을 설정합니다. Visual Studio 10에서도 작동합니다.
Private timer As System.Threading.Timer
Private ideTitle As String = Nothing
Declare Auto Function SetWindowText Lib "user32" (ByVal hWnd As System.IntPtr, _
ByVal lpstring As String) As Boolean
'''<summary>Called when any window in VS gets activated.</summary>
'''<param name="GotFocus">Window that got focus.</param>
'''<param name="LostFocus">Window that lost focus.</param>
Private Sub WindowEvents_WindowActivated(ByVal GotFocus As EnvDTE.Window, ByVal LostFocus As EnvDTE.Window) Handles WindowEvents.WindowActivated
Try
If timer Is Nothing Then
' Create timer which refreshes the caption because
' IDE resets the caption very often
Dim autoEvent As New System.Threading.AutoResetEvent(False)
Dim timerDelegate As System.Threading.TimerCallback = _
AddressOf tick
timer = New System.Threading.Timer(timerDelegate, autoEvent, 0, 200)
End If
If GotFocus.Document Is Nothing Then
ideTitle = Nothing
Else
ideTitle = GotFocus.Document.FullName
showTitle(ideTitle)
End If
Catch ex As System.Exception
End Try
End Sub
''' <summary>Dispose the timer on IDE shutdown.</summary>
Public Sub DTEEvents_OnBeginShutdown() Handles DTEEvents.OnBeginShutdown
If Not timer Is Nothing Then
timer.Dispose()
End If
End Sub
'''<summary>Called by timer.</summary>
Public Sub tick(ByVal state As Object)
Try
If Not ideTitle Is Nothing Then
showTitle(ideTitle)
End If
Catch ex As System.Exception
End Try
End Sub
'''<summary>Shows the title in main window.</summary>
Private Sub showTitle(ByVal title As String)
SetWindowText(New System.IntPtr(DTE.MainWindow.HWnd), title & " - " & DTE.Name)
End Sub
2012 년에는 System.Windows.Application.Current.MainWindow.Title
이것이 작동 하도록 설정 해야합니다. 그러면 TaskBarItem 제목과 MainWindow 제목이 모두 업데이트됩니다.
이것은 메인 스레드에서만 가능하며 제목은 Visual Studio에 의해 다양한 지점에서 업데이트되므로 일부 이벤트에 연결하고 원하는대로 재설정해야합니다 (내 AddIn에서 일부를 사용 EnvDTE.SolutionEvents
합니다. ).
도움이 되었기를 바랍니다.
VS 자동화 모델에는
_DTE.MainWindow.Capation
시작할 수 있습니다.
http://msdn.microsoft.com/en-us/library/envdte._dte.mainwindow.aspx 참조
참고 URL : https://stackoverflow.com/questions/577188/how-to-change-the-title-bar-text-of-visual-studio
'IT TIP' 카테고리의 다른 글
x = std :: move (x) 정의되지 않았습니까? (0) | 2020.12.01 |
---|---|
PHP에서 웹 스크레이퍼를 구현하는 방법은 무엇입니까? (0) | 2020.12.01 |
Android에서 확장 가능한 패널을 구현하는 방법은 무엇입니까? (0) | 2020.12.01 |
이름으로 스왑 파일을 찾았습니다. (0) | 2020.12.01 |
리소스로 시도하기위한 8 가지 지점-Jacoco 커버리지 가능? (0) | 2020.12.01 |