首页 > 解决方案 > 使用扩展包时如何修改SSMS(18)中的状态栏和标题背景颜色?

问题描述

我创建了一个扩展包项目,当文档打开时,我想在使用不同的 sql 连接时修改文档颜色。

我只能获得 DTE 和 WindowActivated 事件。

dte = Package.GetGlobalService(typeof(DTE)) as EnvDTE80.DTE2;
dte.Events.WindowEvents.WindowActivated += OnWindowCreated;

我想得到这个结果: 结果

标签: c#visual-studiossmsvisual-studio-extensionsvs-extensibility

解决方案


在我们的应用程序中,我们设置了类似这样的颜色

IVsWindowFrame frame;
frame.GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out object docView);
var strip = GetPrivateMember<System.Windows.Forms.StatusStrip>(docView, "statusBar");
strip.BackColor = _your_color_;

IVsWindowFrame例如,您可以通过这种方式获得 - 您可以IVsRunningDocTableEvents3在此方法中为您的文档创建实现并存储框架

public int OnBeforeDocumentWindowShow(uint docCookie, int fFirstShow, IVsWindowFrame pFrame)


推荐阅读