怎么把复选框的灰色背景色去掉或者改成白色?

时间:2022-06-29 14:48:42
RT,是在视图VIEW中动态生成的复选框~!想要将其透明或者背景色改成白色~!

6 个解决方案

#1


在OnCtlColor中设置为透明

#2


WM_CTLCOLOR消息

#3


case WM_CREATE:
     brush=CreateSolidBrush(RGB(0,255,0));
     break;
case WM_CTLCOLORSTATIC:
     hdc1=(HDC)wParam;
     SetTextColor(hdc1,RGB(255,0,0));//这是红字绿景的
     SetBkColor(hdc1,RGB(0,255,0));//情况,至于你要的情况,改为RGB(255,255,255)
     return   (LRESULT)brush;//记得之前声明一个HBRUSH brush;

#4


case WM_CTLCOLORSTATIC:
  SetBkColor((HDC)wParam,RGB(255,255,255));
  return (LRESULT)GetStockObject(WHITE_BRUSH);

#5


引用 3 楼 sunyongliang118 的回复:
case WM_CREATE:
     brush=CreateSolidBrush(RGB(0,255,0));
     break;
case WM_CTLCOLORSTATIC:
     hdc1=(HDC)wParam;
     SetTextColor(hdc1,RGB(255,0,0));//这是红字绿景的
     SetBkColor(hdc1,RGB(0,2……


自己切割出来的视图里面VIEW类中貌似没有WM_CTLCOLORSTATIC哦~!

#6


引用 5 楼 zereyyoooo 的回复:
引用 3 楼 sunyongliang118 的回复:

case WM_CREATE:
brush=CreateSolidBrush(RGB(0,255,0));
break;
case WM_CTLCOLORSTATIC:
hdc1=(HDC)wParam;
SetTextColor(hdc1,RGB(255,0,0));//这是红字绿景的
SetBkColor(hdc1,RG……

我的是用SDK做的,你要使用MFC的话,
http://topic.csdn.net/t/20020915/16/1025369.html
这个有参考意义。

#1


在OnCtlColor中设置为透明

#2


WM_CTLCOLOR消息

#3


case WM_CREATE:
     brush=CreateSolidBrush(RGB(0,255,0));
     break;
case WM_CTLCOLORSTATIC:
     hdc1=(HDC)wParam;
     SetTextColor(hdc1,RGB(255,0,0));//这是红字绿景的
     SetBkColor(hdc1,RGB(0,255,0));//情况,至于你要的情况,改为RGB(255,255,255)
     return   (LRESULT)brush;//记得之前声明一个HBRUSH brush;

#4


case WM_CTLCOLORSTATIC:
  SetBkColor((HDC)wParam,RGB(255,255,255));
  return (LRESULT)GetStockObject(WHITE_BRUSH);

#5


引用 3 楼 sunyongliang118 的回复:
case WM_CREATE:
     brush=CreateSolidBrush(RGB(0,255,0));
     break;
case WM_CTLCOLORSTATIC:
     hdc1=(HDC)wParam;
     SetTextColor(hdc1,RGB(255,0,0));//这是红字绿景的
     SetBkColor(hdc1,RGB(0,2……


自己切割出来的视图里面VIEW类中貌似没有WM_CTLCOLORSTATIC哦~!

#6


引用 5 楼 zereyyoooo 的回复:
引用 3 楼 sunyongliang118 的回复:

case WM_CREATE:
brush=CreateSolidBrush(RGB(0,255,0));
break;
case WM_CTLCOLORSTATIC:
hdc1=(HDC)wParam;
SetTextColor(hdc1,RGB(255,0,0));//这是红字绿景的
SetBkColor(hdc1,RG……

我的是用SDK做的,你要使用MFC的话,
http://topic.csdn.net/t/20020915/16/1025369.html
这个有参考意义。