Udostępnij za pośrednictwem


RibbonDropDownItem.OfficeImageId Property (2007 System)

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

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

Syntax

'Declaration
Public Property OfficeImageId As String
'Usage
Dim instance As RibbonDropDownItem 
Dim value As String 

value = instance.OfficeImageId

instance.OfficeImageId = value
public string OfficeImageId { get; set; }
public:
property String^ OfficeImageId {
    String^ get ();
    void set (String^ value);
}
public function get OfficeImageId () : String 
public function set OfficeImageId (value : String)

Property Value

Type: System.String
The image to display on the RibbonDropDownItem, if you want to use a built-in Microsoft Office icon.

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 2007 Office System 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 Microsoft Office icons to two items in a drop down box.

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

  1. Add a Ribbon (Visual Designer) item to a Visual Studio Tools for Office project.

  2. Add a group to the custom tab.

  3. Add a drop down box to the group.

Private Sub PopulateDropDown()
    Dim status1 As RibbonDropDownItem = New RibbonDropDownItem
    status1.Label = "Away"
    status1.OfficeImageId = "PersonaStatusAway"
    DropDown1.Items.Add(status1)
    Dim status2 As RibbonDropDownItem = New RibbonDropDownItem
    status2.Label = "Online"
    status2.OfficeImageId = "PersonaStatusOnline"
    DropDown1.Items.Add(status2)
End Sub
private void PopulateDropDown()
{
    RibbonDropDownItem status1 = new RibbonDropDownItem();
    status1.Label = "Away";
    status1.OfficeImageId = "PersonaStatusAway";
    dropDown1.Items.Add(status1);
    RibbonDropDownItem status2 = new RibbonDropDownItem();
    status2.Label = "Online";
    status2.OfficeImageId = "PersonaStatusOnline";
    dropDown1.Items.Add(status2);
}

.NET Framework Security

See Also

Reference

RibbonDropDownItem Class

RibbonDropDownItem Members

Microsoft.Office.Tools.Ribbon Namespace

Other Resources

Ribbon Object Model Overview