最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - Switch Toolbar button icon in Visual Studio extension - Stack Overflow

programmeradmin6浏览0评论

I've created a toolbar button in a Visual Studio extension. This toolbar contains a button with text and icon.

The button has two states. When first clicked, the button displays icon1. After a second click, the button displays icon2. The button will switch between these two icons.

I also wants to display different tooltip help for icon1 and icon2.

Is it possible to switch button icon with Visual Studio extension toolbar?

I've created a toolbar button in a Visual Studio extension. This toolbar contains a button with text and icon.

The button has two states. When first clicked, the button displays icon1. After a second click, the button displays icon2. The button will switch between these two icons.

I also wants to display different tooltip help for icon1 and icon2.

Is it possible to switch button icon with Visual Studio extension toolbar?

Share Improve this question edited Mar 26 at 1:34 Dou Xu-MSFT 3,5461 gold badge5 silver badges8 bronze badges asked Mar 25 at 8:26 nonadoesnonadoes 255 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Is it possible to switch button icon with Visual Studio extension toolbar?

I am afraid not. I think there is no built-in feature/class to switch button icon upon click event.

From looking at this document OleMenuCommand Class

If the command is added dynamically, it makes more sense to use OleMenuCommand, in order to implement the BeforeQueryStatus handler.

Looks like we can update the status of the menu command in this method OnBeforeQueryStatus by changing the Visible, Checked, and Enabled properties on the OleMenuCommand object.

You can change the text of a menu command by following this guide1

You can change the appearance of a command by following this guide2

However i would suggest you can also report this issue at Visual Studio Forum to double confirm if there is any available feature to achieve it. That will allow you to directly interact with the appropriate product group, and make it more convenient for the product group to collect and categorize your issue.

发布评论

评论列表(0)

  1. 暂无评论