功能区XML - 如何基于checkBox状态以编程方式启用/禁用ediBox [英] Ribbon XML - How to programmatically enable/disable ediBox based on checkBox state

查看:102
本文介绍了功能区XML - 如何基于checkBox状态以编程方式启用/禁用ediBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用C#或VBA,当用户检查/取消选中复选框时,如何使editBox启用/禁用。

Using C# or VBA how can we make the editBox gets enabled/disabled when user checks/unchecks the checkBox.

<tab idMso="TabAddIns">  
    <group id="ContentGroup" label="Content">  
        <editBox id ="editBoxID" getEnabled="editBox_getEnabled" enabled="false" getText="Some text"/>
          <checkBox id="checkBoxID" label="Edit" getPressed="CheckBox_getPressed"/>  
    </group>  
</tab>  

推荐答案

你好,

CheckBox_getPressed 回调中,您需要调用
无效

InvalidateControl
方法允许to  在功能区用户界面上验证控件的缓存值。在
editBox_getEnabled 回调中,您可以检查是否应该启用控件并返回适当的值。 

In the CheckBox_getPressed callback you need to call the Invalidate or InvalidateControl method of the IRibbonUI interface which allows to nvalidate the cached value for a control(s) on the Ribbon user interface. In the editBox_getEnabled callback you can check whether to the control should be enabled or not and return an appropriate value. 

在MSDN的以下系列文章中阅读更多相关内容:

第11章:创建动态功能区自定义(1/2)


11:创建动态功能区自定义(2/2)

Chapter 11: Creating Dynamic Ribbon Customizations (2 of 2)


这篇关于功能区XML - 如何基于checkBox状态以编程方式启用/禁用ediBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆