16,472
社区成员
发帖
与我相关
我的任务
分享
case WM_PAINT:
{
PAINTSTRUCT ps;
BeginPaint(hwnd,&ps);
HDC hdc=GetDC(GetDlgItem(hwndList,IDC_LIST));
RECT rect;
GetWindowRect(hwndList,&rect);
POINT pt1,pt2;
pt1.x=rect.left;
pt1.y=rect.top;
pt2.x=rect.right;
pt2.y=rect.bottom;
ScreenToClient(hwnd,&pt1);
ScreenToClient(hwnd,&pt2);
rect.left=pt1.x;
rect.top=pt1.y;
rect.right=pt2.x;
rect.bottom=pt2.y;
FillRect(hdc,&rect,(HBRUSH)GetStockObject(BLACK_BRUSH));
ReleaseDC(GetDlgItem(hwndList,IDC_LIST),hdc);
EndPaint(hwnd,&ps);
}
return 0 ;
break;
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc;
RECT rect;
POINT pt1,pt2;
BeginPaint(hwnd,&ps);
EndPaint(hwnd,&ps);
GetWindowRect(hwndList,&rect);
//使自控件有效
ValidateRect(GetDlgItem(hwnd,ID_LIST),&rect);
pt1.x=rect.left;
pt1.y=rect.top;
pt2.x=rect.right;
pt2.y=rect.bottom;
ScreenToClient(hwnd,&pt1);
ScreenToClient(hwnd,&pt2);
rect.left=pt1.x;
rect.top=pt1.y;
rect.right=pt2.x;
rect.bottom=pt2.y;
//取客户区域,使之变黑色
GetClientRect(hwndList,&rect);
hdc=GetDC(GetDlgItem(hwnd,ID_LIST));
FillRect(hdc,&rect,(HBRUSH)GetStockObject(BLACK_BRUSH));
ReleaseDC(GetDlgItem(hwnd,ID_LIST),hdc);
return 0 ;
}
break;
很明显没看到黑色