简体   繁体   English

更改ribbbon中的按钮图标

[英]Changing the icon of a button in ribbbon

I have a ribbon application that designed based on Extensible Application Markup Language (XAML) in c++. 我有一个基于c ++的Extensible Application Markup Language (XAML)设计的功能区应用程序。 I want to change the icon of one button when i click on it. 我想在单击一个按钮时更改其图标。 How can i change the icon? 如何更改图标? My application is not MFC, I use Windows API . 我的应用程序不是MFC,而是使用Windows API

You can't change the icon of a button when clicking, at least not in a regular way. 单击时不能更改按钮的图标,至少不能以常规方式更改。 The API doesn't support this, I guess for the reason that the UI Ribbon UI concept doesn't intend such a behavior (and you may want to think twice, before breaking an "intended behavior"). 该API不支持此功能,我猜这是因为UI Ribbon UI概念不打算出现这种行为(并且您可能想三思而后行,然后再打破“预期行为”)。

Anyway, you could force such a behavior by loading a resource file that refers to the very same XML definition (XML by the way, NOT XAML - we are not in the WPF world here), with the only exception being the source path of the regarding icon referring to something different. 无论如何,您可以通过加载引用完全相同的XML定义的资源文件(顺便说一句XML, 不是XAML-我们不在WPF世界中)来引用这种资源文件,唯一的例外是关于图标指的是不同的东西。

The relevant API call for this is called IUIFramework::LoadUI . 为此的相关API调用称为IUIFramework :: LoadUI

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM