共用方式為


RibbonSplitButton.OfficeImageId Property

Gets or sets the image to display on the RibbonSplitButton control, if you want to use a built-in Microsoft Office icon.

Namespace:  Microsoft.Office.Tools.Ribbon
Assembly:  Microsoft.Office.Tools.Common (in Microsoft.Office.Tools.Common.dll)

Syntax

'Declaration
Property OfficeImageId As String
string OfficeImageId { get; set; }

Property Value

Type: System.String
The ID of a built-in Microsoft Office icon that serves as the icon for this control.

Remarks

The OfficeImageId property identifies an Office icon that is displayed by the control. The property value is a string that identifies the imageMso value of the selected icon. This property can be set at design time or at run time. If you update this property at run time, the control's appearance is updated to reflect the change.

For a list of imageMso values, see the Microsoft Download Center page Office 2010 Add-In: Icons Gallery.

This property is ignored if the Image property is set. Images identified by the OfficeImageId property can be loaded slightly faster than images identified by the Image property, because the images are cached in the Office application.

Examples

The following example assigns a Microsoft Office icon to a split button.

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

  1. Add a Ribbon (Visual Designer) item to a project created by using Office development tools in Visual Studio.

  2. Add a group to the custom tab.

  3. Add a split button to the group.

Private Sub SetSplitButtonImage()
    SplitButton1.OfficeImageId = "HighImportance" 
End Sub
private void SetSplitButtonImage()
{
    splitButton1.OfficeImageId = "HighImportance";
}

.NET Framework Security

See Also

Reference

RibbonSplitButton Interface

Microsoft.Office.Tools.Ribbon Namespace

Other Resources

Ribbon Object Model Overview