

| Type | Description | |||
| PictureDisplayEnum | A PictureDisplayEnum expression that specifies how the picture is displayed on the menu's background. | 

The following VB sample assigns a picture to a submenu:
With ExMenu1(10).SubMenu
    .PictureDisplay = Tile
    .Picture = LoadPicture("c:\winnt\zapotec.bmp")
End With
  The following C++ sample assigns a picture to a submenu:
IPictureDisp* pPicture = NULL;
if ( LoadPicture( "c:\\winnt\\zapotec.bmp", &pPicture ) )
{
	CMenu1 subMenu = m_menu.GetItem( COleVariant(long(10)) ).GetSubMenu();
	subMenu.SetPicture( pPicture );
	subMenu.SetPictureDisplay( 48 /*Tile*/ );
}
  where the LoadPicture function gets the IPictureDisp from a file:
#includeBOOL LoadPicture( LPCTSTR szFileName, IPictureDisp** ppPictureDisp ) { BOOL bResult = FALSE; if ( szFileName ) { OFSTRUCT of; HANDLE hFile = NULL;; #ifdef _UNICODE USES_CONVERSION; if ( (hFile = (HANDLE)OpenFile( W2A(szFileName), &of, OF_READ | OF_SHARE_COMPAT)) != (HANDLE)HFILE_ERROR ) #else if ( (hFile = (HANDLE)OpenFile( szFileName, &of, OF_READ | OF_SHARE_COMPAT)) != (HANDLE)HFILE_ERROR ) #endif { *ppPictureDisp = NULL; DWORD dwHighWord = NULL, dwSizeLow = GetFileSize( hFile, &dwHighWord ); DWORD dwFileSize = dwSizeLow; HRESULT hResult = NULL; if ( HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE, dwFileSize) ) if ( void* pvData = GlobalLock( hGlobal ) ) { DWORD dwReadBytes = NULL; BOOL bRead = ReadFile( hFile, pvData, dwFileSize, &dwReadBytes, NULL ); GlobalUnlock( hGlobal ); if ( bRead ) { CComPtr spStream; _ASSERTE( dwFileSize == dwReadBytes ); if ( SUCCEEDED( CreateStreamOnHGlobal( hGlobal, TRUE, &spStream) ) ) if ( SUCCEEDED( hResult = OleLoadPicture( spStream, 0, FALSE, IID_IPictureDisp, (void**)ppPictureDisp ) ) ) bResult = TRUE; } } CloseHandle( hFile ); } } return bResult; } 
The following VB.NET sample assigns a picture to a submenu:
With AxExMenu1.item(10).SubMenu
    .Picture = IPDH.GetIPictureDisp(Image.FromFile("c:\winnt\zapotec.bmp"))
    .PictureDisplay = EXMENULib.PictureDisplayEnum.Tile
End With
  where the IPDH class is defined like follows:
Public Class IPDH
    Inherits System.Windows.Forms.AxHost
    Sub New()
        MyBase.New("")
    End Sub
    Public Shared Function GetIPictureDisp(ByVal image As Image) As Object
        GetIPictureDisp = AxHost.GetIPictureDispFromPicture(image)
    End Function
End Class
  The following C# sample assigns a picture to a submenu:
EXMENULib.Menu subMenu = axExMenu1[10].SubMenu;
subMenu.Picture = IPDH.GetIPictureDisp(Image.FromFile("c:\\winnt\\zapotec.bmp")) as stdole.IPictureDisp ;
subMenu.PictureDisplay = EXMENULib.PictureDisplayEnum.Tile;
  The following VFP sample assigns a picture to a submenu:
With thisform.ExMenu1.Item(10).SubMenu
        .PictureDisplay = 48 && Tile
        .Picture = LoadPicture("c:\WinNT\Zapotec.bmp")
EndWith