为什么 Visual Studio 2010 在启动时隐藏我的加载项工具栏?
我有一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,问题在于太早设置工具栏的可见性。
当您延迟设置可见性直到工具栏完全配置完毕时,它就可以在 VS 2010 中工作 - 这很奇怪,因为相同的代码在 VS 2003、VS 2005 和 VS 2008 中工作得很好!
无论如何,要保持工具栏在 AlphaBlend 代码示例中可见,请注释掉工具栏配置行,如下所示:
并在将控件添加到工具栏后恢复它们:
感谢 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:
And reinstate them after the controls have been added to the toolbar:
Thanks to NeelimaM for helping to spot this over on the MSDN Code Gallery site.