Share via


CommandBarButtonClass.Picture Property

Gets or sets an IPictureDisp object representing the image of a CommandBarButton object. Read/write.

Namespace:  Microsoft.Office.Core
Assembly:  office (in office.dll)

Syntax

'Declaration
Public Overridable Property Picture As IPictureDisp
    Get
    Set
'Usage
Dim instance As CommandBarButtonClass
Dim value As IPictureDisp

value = instance.Picture

instance.Picture = value
public virtual IPictureDisp Picture { get; set; }

Property Value

Type: IPictureDisp

Implements

_CommandBarButton.Picture

Remarks

When you change the image on a button, you will also want to use the Mask property to set a mask image. The mask image determines which parts of the button image are transparent. Always set the mask after you have set the picture for a CommandBarButton object.

Note

The images for the View MicrosoftApplication and Insert Item buttons on the Standard toolbar in the Visual Basic Editor cannot be changed.

Examples

The following example sets the image and mask of the first CommandBarButton that the code returns. To make this work, create a mask image and a button image and substitute the paths in the sample with the paths to your images.

The following example gets the image and mask of the first CommandBarButton that the code returns and outputs each of them to a file. To make this work, specify a path for the output files.

See Also

Reference

CommandBarButtonClass Class

CommandBarButtonClass Members

Microsoft.Office.Core Namespace