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

RibbonComboBox.ImageName 屬性

 

取得或設定您在 LoadImage 事件處理常式中,用來識別控制項影像的名稱。

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

string ImageName { get; set; }

屬性值

Type: System.String

您可在 LoadImage 事件處理常式中使用的字串,以用於識別控制項的影像。

This property can be set at run time only under certain conditions. For more information, see Ribbon Object Model Overview.

For information about setting this property, see Ribbon Object Model Overview.

The P:Microsoft.Office.Tools.Ribbon.RibbonComboBox.ImageName property identifies an image that is displayed by the control. The Office application retrieves this image from your solution only once, to improve performance. This property can be set only at design time, because the image it identifies is loaded during the E:Microsoft.Office.Tools.Ribbon.OfficeRibbon.LoadImage event. E:Microsoft.Office.Tools.Ribbon.OfficeRibbon.LoadImage is raised only once per image name, when the Ribbon is displayed. After that, the control image cannot be changed by using this property.

To load the image, add code to the E:Microsoft.Office.Tools.Ribbon.OfficeRibbon.LoadImage event handler. Check the P:Microsoft.Office.Tools.Ribbon.RibbonLoadImageEventArgs.ImageName property of the T:Microsoft.Office.Tools.Ribbon.RibbonLoadImageEventArgs and set the P:Microsoft.Office.Tools.Ribbon.RibbonLoadImageEventArgs.Image property of the T:Microsoft.Office.Tools.Ribbon.RibbonLoadImageEventArgs object to the image that you want to load.

This property is ignored if either the P:Microsoft.Office.Tools.Ribbon.RibbonComboBox.Image property or the P:Microsoft.Office.Tools.Ribbon.RibbonComboBox.OfficeImageId property is set. Images identified by the P:Microsoft.Office.Tools.Ribbon.RibbonComboBox.ImageName property can be loaded slightly faster than images identified by the P:Microsoft.Office.Tools.Ribbon.RibbonComboBox.Image property, because the Office application retrieves the image from your solution only the first time the Ribbon is displayed.

The P:Microsoft.Office.Tools.Ribbon.RibbonComboBox.ShowImage property must be true for the control to display the image. When you set the P:Microsoft.Office.Tools.Ribbon.RibbonComboBox.ImageName property at design time, Visual Studio automatically sets the P:Microsoft.Office.Tools.Ribbon.RibbonComboBox.ShowImage property to true. If you set the P:Microsoft.Office.Tools.Ribbon.RibbonComboBox.ImageName property at run time, you must set the P:Microsoft.Office.Tools.Ribbon.RibbonComboBox.ShowImage property to true in your code.

回到頁首
顯示: