为什么 Visual Studio 2010 在启动时隐藏我的加载项工具栏?

发布于 2024-09-05 03:35:10 字数 376 浏览 1 评论 0原文

我有一个 VS 加载项,它创建一个工具栏并在 VS 启动时显示它(基于以前的可见性设置)。 该加载项在 VS 2005 和 2008 中工作正常,但在 2010 年,工具栏仅在 VS 加载时可见。

一旦 VS 完成加载,工具栏就会消失。

我可以使用 Alpha Blend 代码示例复制示例问题: http://code.msdn.microsoft.com /AlphaBlendToolbar

重现: 注册加载项并将其配置为在 VS 启动时启动。 关闭VS并重新打开它。 工具栏会显示一段时间,然后就消失了!

I've a VS add-in that creates a toolbar and displays it (based on previous visibility settings) when VS launches.
The add-in works fine in VS 2005 and 2008 but in 2010, the toolbar is only visible while VS is loading.

Once VS has completed loading, the toolbar disappears.

I can replicate the sample problem with the Alpha Blend code sample: http://code.msdn.microsoft.com/AlphaBlendToolbar

To reproduce:
Register the add-in and configure it to start when VS starts.
Close VS and re-open it.
The toolbar is visible for a few moments and it then disappears!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

她比我温柔 2024-09-12 03:35:10

事实证明,问题在于太早设置工具栏的可见性。
当您延迟设置可见性直到工具栏完全配置完毕时,它就可以在 VS 2010 中工作 - 这很奇怪,因为相同的代码在 VS 2003、VS 2005 和 VS 2008 中工作得很好!

无论如何,要保持工具栏在 AlphaBlend 代码示例中可见,请注释掉工具栏配置行,如下所示:

CommandBar toolbar = commandBars.Add("AlphaToolbar", MsoBarPosition.msoBarTop, System.Type.Missing, true);
//toolbar.Visible = true;
//toolbar.Enabled = true;

并在将控件添加到工具栏后恢复它们:

commandOmega.AddControl(toolbar, 2);
toolbar.Visible = true;
toolbar.Enabled = true;

感谢 NeelimaM 帮助在 MSDN 代码库网站上发现这一点。

As it turns out, the problem is with setting the visibility of the toolbar too early.
When you delay setting the visibility until the toolbar is completely configured, then it works in VS 2010 - which is strange as the same code worked fine in VS 2003, VS 2005 and VS 2008!

Anyway, to keep the toolbar visible in the AlphaBlend code sample, comment out the toolbar configuration lines as below:

CommandBar toolbar = commandBars.Add("AlphaToolbar", MsoBarPosition.msoBarTop, System.Type.Missing, true);
//toolbar.Visible = true;
//toolbar.Enabled = true;

And reinstate them after the controls have been added to the toolbar:

commandOmega.AddControl(toolbar, 2);
toolbar.Visible = true;
toolbar.Enabled = true;

Thanks to NeelimaM for helping to spot this over on the MSDN Code Gallery site.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文