Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Position some text in the left area of pop-up menu with Prof-UIS 2.90 Collapse All
Subject Author Date
Nicolas Pinaud Aug 25, 2010 - 3:38 AM

 


Hello,


I make a new thread for more, it is more clear. 


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 );

 ASSERT( pDrawLeftAreaData != NULL );

 ASSERT( pDrawLeftAreaData->m_pPopup != NULL );

 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();

 

 const int nIconMetric = 24;

 HICON hIcon = (HICON)::LoadImage(::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_SACHATYPE), IMAGE_ICON, nIconMetric, nIconMetric, 0);

 if( hIcon != NULL )

 {

  int nOffset = (rcItem.Width() - nIconMetric) / 2;

  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 );

 dc.SelectObject( pFont );

 

 return (!0);

}


////////////////////////////////////////////////////////////////////////////////////////////////////