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

RibbonLoadImageEventArgs 介面

 

提供 LoadImage 事件的資料。

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

[GuidAttribute("faacd97a-39b2-4c40-a1c2-6eec43ce950f")]
public interface RibbonLoadImageEventArgs

名稱描述
System_CAPS_pubpropertyImage

取得或設定您想要載入的功能區控制項之影像。

System_CAPS_pubpropertyImageName

取得在功能區載入的影像之名稱。

Handle the E:Microsoft.Office.Tools.Ribbon.OfficeRibbon.LoadImage event if you want to load an image that is identified by the ImageName property of a control. The Microsoft Office application retrieves this image from your solution only once, when the Ribbon is displayed, to improve performance. After that, the control image cannot be changed.

To load an image for a control, add code to the E:Microsoft.Office.Tools.Ribbon.OfficeRibbon.LoadImage event handler. If the P:Microsoft.Office.Tools.Ribbon.RibbonLoadImageEventArgs.ImageName property of the T:Microsoft.Office.Tools.Ribbon.RibbonLoadImageEventArgs matches the ImageName property of the control, set the P:Microsoft.Office.Tools.Ribbon.RibbonLoadImageEventArgs.Image property to the image that you want to load.

The following example caches the images for two T:Microsoft.Office.Tools.Ribbon.RibbonButton controls.

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 group to the custom tab.

  3. Add two buttons to the group.

  4. Add two images to the project resources.

private void Ribbon1_LoadImage(object sender, RibbonLoadImageEventArgs e)
{
    switch (e.ImageName)
    {
        case "Button1Image":
            e.Image = Properties.Resources.Image1;
            break;
        case "Button2Image":
            e.Image = Properties.Resources.Image2;
            break;
    }
}
回到頁首
顯示: