

| Type | Description | |||
| PictureDisplayEnum | A PictureDisplayEnum expression that indicates how the picture is arranged on the control's background. |
The PictureDisplay property as no effect if the control's background has no picture assigned. Use the Picture property to put a picture on the control's background. Use the PictureDisplay property to arrange the picture on the background of a popup menu. Use the Picture property to load a picture on the drop down menu's background.

The following VB sample puts a picture on the control's background:
With ExMenu1
.PictureDisplay = Tile
.Picture = LoadPicture("c:\WinNT\Zapotec.bmp")
End With
The following C++ sample puts a picture on the control's background:
IPictureDisp* pPicture = NULL;
if ( LoadPicture( "c:\\winnt\\zapotec.bmp", &pPicture ) )
{
m_menu.SetPicture( pPicture );
m_menu.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 puts a picture on the control's background:
With AxExMenu1
.Picture = Image.FromFile("c:\winnt\zapotec.bmp")
.PictureDisplay = EXMENULib.PictureDisplayEnum.Tile
End With
The following C# sample puts a picture on the control's background:
axExMenu1.Picture = Image.FromFile("c:\\winnt\\zapotec.bmp");
axExMenu1.PictureDisplay = EXMENULib.PictureDisplayEnum.Tile;
The following VFP sample puts a picture on the control's background:
With thisform.ExMenu1
.PictureDisplay = 48 && Tile
.Picture = LoadPicture("c:\WinNT\Zapotec.bmp")
EndWith