Hello,
I boost the thread.
I am sorry, but I do not manage to reformat correctly my pop-menu, and more particularly to reposition my text correctly in the left area of the pop-menu.
Can you say to me what is bad my code?
The orientation of the text is correct, but I do not manage to place it correctly, as in your example ProfUIS_Controls-ym.exe
Thanks a lot for your help.
///////////////////////////////////////////////////////////////////////////////////////////
LRESULT CFicheJournaliere::OnDrawPopupLeftArea(WPARAM wParam, LPARAM lParam)
{
wParam;
CExtPopupMenuWnd::DRAWLEFTAREADATA * pDrawLeftAreaData =
reinterpret_cast < CExtPopupMenuWnd::DRAWLEFTAREADATA * > ( lParam );if( (pDrawLeftAreaData->m_pPopup->TrackFlagsGet()&TPMX_PALETTE) != 0 )return 0;// get draw DC
CDC & dc = *( (CDC *) *pDrawLeftAreaData );
CRect rcItem = LPCRECT(*pDrawLeftAreaData);
CExtPaintManager::stat_PaintGradientRect(dc,&rcItem,dc.GetNearestColor( RGB( 0, 0, 0 ) ),dc.GetNearestColor( RGB( 100, 100, 255 ) ), true);
INT nOldBkMode = dc.SetBkMode( TRANSPARENT );
COLORREF clrOldText = dc.SetTextColor( RGB( 0, 0, 0 ) );
CFont font;
font.CreateFont(-18, 0, 900, 900,900, 0, 0, 0, 0, 0, 0, 0, 0, "Times New Roman");
CFont* pFont = dc.SelectObject(&font);
dc.SetTextColor( RGB( 255, 255, 255 ) );
dc.DrawText("Sacha", rcItem,DT_SINGLELINE | DT_CENTER | DT_VCENTER);
dc.SelectObject(pFont);
font.DeleteObject();
HICON hIcon = (HICON)
::LoadImage(::AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR_SACHATYPE),IMAGE_ICON,nIconMetric,nIconMetric,0);
{
VERIFY(::DrawIconEx(dc.GetSafeHdc(),rcItem.left + nOffset,rcItem.top + nOffset,hIcon,nIconMetric,nIconMetric,0,(HBRUSH)NULL, DI_NORMAL));
VERIFY( DestroyIcon( hIcon ) );
}
dc.SetBkMode( nOldBkMode );
dc.SetTextColor( clrOldText );
const int nIconMetric = 24;if( hIcon != NULL )int nOffset = (rcItem.Width() - nIconMetric) / 2;
dc.SelectObject( pFont );
}
return (!0);
///////////////////////////////////////////////////////////////////////////////////////////
ASSERT( pDrawLeftAreaData != NULL );
ASSERT( pDrawLeftAreaData->m_pPopup != NULL );