Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 25th, 2012  |  syntax: None  |  size: 0.97 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to change color of a button label? I.e. get the right text position?
  2. case WM_CTLCOLORSTATIC: {
  3.    // check for intended button omitted
  4.    INT_PTR br=SendMessage(Wnd,WM_CTLCOLORDLG,wParam,(LPARAM)Wnd);
  5.    SetTextColor((HDC)wParam,RGB(255,0,0));
  6.    return br;
  7.   }break;
  8.        
  9. case WM_NOTIFY: {
  10.    LPNMCUSTOMDRAW n=(LPNMCUSTOMDRAW)lParam;
  11.    if (n && n->hdr.code==NM_CUSTOMDRAW
  12.    && n->hdr.idFrom==ID_I_WANT
  13.    && n->dwDrawStage==CDDS_PREPAINT) {
  14.     SetTextColor(n->hdc,RGB(255,0,0));
  15.     return TRUE;
  16.    }
  17.   }break;
  18.        
  19. ...
  20.    TCHAR s[32];
  21.    GetWindowText(n->hdr.hwndFrom,s,32);
  22.    DTTOPTS opt;
  23.    opt.dwSize=sizeof(opt);
  24.    opt.dwFlags=DTT_TEXTCOLOR;
  25.    opt.crText=RGB(255,0,0);
  26.    DrawThemeTextEx(GetWindowTheme(n->hdr.hwndFrom),n->hdc,BP_CHECKBOX,
  27.      CBS_UNCHECKEDNORMAL,s,-1,0,&n->rc,&opt);
  28.    SetWindowLong(Wnd,DWL_MSGRESULT,CDRF_SKIPDEFAULT);
  29.    ...
  30.        
  31. SIZE sz;
  32.    GetThemePartSize(GetWindowTheme(n->hdr.hwndFrom),n->hdc,
  33.      BP_CHECKBOX,CBS_UNCHECKEDNORMAL,NULL,TS_DRAW,&sz);