去除静态文本框的背景色和设置颜色

时间:2022-01-21 14:49:48

//缺省的静态文本框有一个灰色的背景色,确实很讨厌,字体颜色也很单调,不过我们可以设置

case WM_CTLCOLORSTATIC://设置静态文本框字体颜色
  {
   if (GetDlgItem(hwnd, 1) == (HWND)lParam)//这里的1是静态文本框的ID
   {
    SetTextColor((HDC)wParam, RGB(255,0,255));
    SetBkMode((HDC)wParam, TRANSPARENT);
    //return (LRESULT)CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
    return (BOOL)((HBRUSH)GetStockObject(NULL_BRUSH));
   }

break;

}