Table of contents

IRibbonControl 对象 (办公室)IRibbonControl Object (Office)

office 365 dev account|上次更新日期: 2018/3/13
2 参与人员

表示传给功能区中,或可使用 Office Fluent 功能区可扩展性自定义的另一个用户界面中的控件的回调过程的对象。Represents the object passed into the callback procedure of a control in a ribbon or another user interface that can be customized by using Office Fluent ribbon extensibility.


IRibbonControl对象包含控件的名称 (ID) 的控件和窗口当前功能区用户界面。The IRibbonControl object contains the name (ID) of the control and the current Window object for the Ribbon UI control.


下面的示例中,用 C# 编写显示了从按钮控件和切换按钮控件的onAction事件过程中调用的两个过程。在第一个过程中, IRibbonControl对象,该对象表示控件传递给该过程并指明按钮已按下按钮的 ID 并显示一个消息框。第二个过程是类似于第一个,只增加了一个指明按钮已按下的Boolean参数。The following example, written in C#, shows two procedures called from the onAction event procedure of a Button control and a ToggleButton control. In the first procedure, the IRibbonControl object representing the control is passed into the procedure and a message box is displayed indicating that the button was pressed along with the ID of the button. The second procedure is similar to the first with the addition of a Boolean parameter indicating that the button was pressed.

public void ButtonOnAction(IRibbonControl control) 
 MessageBox.Show("Button clicked: " + control.Id); 

public void ToggleButtonOnAction(IRibbonControl control, bool pressed) 
...if (pressed) 
 MessageBox.Show("ToggleButton was switched on."); 
 MessageBox.Show("ToggleButton was switched off."); 

另请参阅See also


对象模型引用Object Model Reference

其他资源Other resources

IRibbonControl 对象成员IRibbonControl Object Members

© 2018 Microsoft