本文為機器翻譯文章。如需檢視英文版,請選取 [原文] 核取方塊。您也可以將滑鼠指標移到文字上,即可在快顯視窗顯示英文原文。
譯文
原文

RibbonGroup.DialogLauncherClick 事件

 

發生於使用者按一下群組中的功能區對話方塊啟動程式圖示時。

命名空間:   Microsoft.Office.Tools.Ribbon
組件:  Microsoft.Office.Tools.Common (於 Microsoft.Office.Tools.Common.dll)

event RibbonControlEventHandler DialogLauncherClick

The Ribbon dialog launcher is a small icon that appears in the group. When the user clicks this icon, you can handle the E:Microsoft.Office.Tools.Ribbon.RibbonGroup.DialogLauncherClick event to open a custom dialog box. By default, groups do not have a Ribbon dialog launcher. For more information, see How to: Add a Dialog Box Launcher to a Ribbon Group.

The following example shows how to add a dialog box launcher to a ribbon group and how to launch a custom dialog that enables users to choose advanced settings when they click on the T:Microsoft.Office.Tools.Ribbon.RibbonDialogLauncher icon in the lower right corner of the T:Microsoft.Office.Tools.Ribbon.RibbonGroup.

To run this code example, you must first perform the following steps:

  1. Add a Ribbon (Visual Designer) item to an Office project.

  2. Add a T:Microsoft.Office.Tools.Ribbon.RibbonDialogLauncher to the default group as outlined in How to: Add a Dialog Box Launcher to a Ribbon Group.

  3. If you are using Visual Basic, add a new Windows Form Dialog item to the project. If you are using C#, add a new Windows Form item and turn it into a dialog by adding an OK and Cancel button to the form and creating event handlers for the buttons' click events.

  4. Set the (Name) property of the dialog to advancedSettingsDialog. You can customize the dialog by adding controls and setting more properties.

  5. Add the E:Microsoft.Office.Tools.Ribbon.RibbonGroup.DialogLauncherClick event handler to your code.

  6. Place the contents of the following method into the E:Microsoft.Office.Tools.Ribbon.RibbonGroup.DialogLauncherClick event handler.

void group1_DialogLauncherClick(object sender, Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs e)
{
    advancedSettingsDialog dlg = new advancedSettingsDialog();
    dlg.ShowDialog();
}
回到頁首
顯示: