Pro*_*ofK 62 visual-studio-2008 visual-studio
我们在相同代码的几个不同分支上工作,当同时处理两个分支时,它可能会变得混乱和浪费时间.
目前,VS标题栏有文字<solution-name> - Visual Studio.
我是否可以编写一个可以生成该文本的扩展名<solution-name>: <branch-name> - <Visual Studio>?
Erw*_*yer 56
我刚刚创建了一个可以提供帮助的小型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/
小智 18
查看最新版本的VSCommands 2010 Lite.它引入了一个名为Friendly Solution Name的功能,您可以在其中设置正则表达式模式以从文件夹结构中提取分支名称并将其放在Visual Studio主窗口标题中.更多细节: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!");
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
25779 次 |
| 最近记录: |