Guest User

Untitled

a guest
Mar 21st, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. if ((p = wcschr( lpitem->Xlpstr, 't' )) != NULL) {
  2. RECT tmprc = rc;
  3. LONG tmpheight;
  4. int n = (int)( p - lpitem->Xlpstr);
  5. /* Item contains a tab (only meaningful in popup menus) */
  6. /* get text size before the tab */
  7. txtheight = DrawTextW( hdc, lpitem->Xlpstr, n, &rc,
  8. DT_SINGLELINE|DT_CALCRECT);
  9. txtwidth = rc.right - rc.left;
  10. p += 1; /* advance past the Tab */
  11. /* get text size after the tab */
  12. tmpheight = DrawTextW( hdc, p, -1, &tmprc,
  13. DT_SINGLELINE|DT_CALCRECT);
  14. lpitem->dxTab += txtwidth;
  15. txtheight = max( txtheight, tmpheight);
  16. txtwidth += MenuCharSize.cx + /* space for the tab */
  17. tmprc.right - tmprc.left; /* space for the short cut */
  18. }
  19.  
  20. Text = lpitem->Xlpstr;
  21. if(Text)
  22. {
  23. for (i = 0; Text[i]; i++)
  24. if (Text[i] == L't' || Text[i] == L'b')
  25. break;
  26. }
  27.  
  28. if(lpitem->fState & MF_GRAYED)
  29.  
  30. DrawTextW( hdc, Text, i, &rect, uFormat);
  31.  
  32. /* paint the shortcut text */
  33. if (!menuBar && L'' != Text[i]) /* There's a tab or flush-right char */
  34. {
  35. if (L't' == Text[i])
  36. {
  37. rect.left = lpitem->dxTab;
  38. uFormat = DT_LEFT | DT_VCENTER | DT_SINGLELINE;
  39. }
  40. else
  41. {
  42. rect.right = lpitem->dxTab;
  43. uFormat = DT_RIGHT | DT_VCENTER | DT_SINGLELINE;
  44. }
  45.  
  46. DrawTextW( hdc, Text + i + 1, -1, &rect, uFormat );
  47. }
Add Comment
Please, Sign In to add comment