HBRUSH brush; //전역변수.
HBRUSH CG_Bit_AnalyzerDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
DeleteObject(brush); //반드시 사용해야한다. 메모리 증가요인.
switch(nCtlColor)
{
case CTLCOLOR_BTN:
case CTLCOLOR_STATIC:
{
// pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(155,155,155));
brush=(HBRUSH)::GetStockObject(NULL_BRUSH);
break;
}
case CTLCOLOR_EDIT:
{
pDC->SetBkMode(TRANSPARENT);
brush=(HBRUSH)::GetStockObject(LTGRAY_BRUSH);
break;
}
case CTLCOLOR_LISTBOX:
{
pDC->SetBkMode(TRANSPARENT); brush=(HBRUSH)::GetStockObject(GRAY_BRUSH); break;
}
case CTLCOLOR_MSGBOX:
{
brush=(HBRUSH)::GetStockObject(LTGRAY_BRUSH);
break;
}
case CTLCOLOR_SCROLLBAR:
{
brush=(HBRUSH)::GetStockObject(GRAY_BRUSH);
break;
}
default:
brush = CreateSolidBrush(RGB(255, 255, 255));
break;
}
return brush;
}
프로그래밍/MFC