朱皮特的博客 自由的飞翔

OnCtlColor解决静态透明以及文本重影问题

2009-10-30
朱皮特
 
阅读量:

HBRUSH CDemoDlg::OnCtlColor(
	CDC* pDC,
	CWnd* pWnd,
	UINT nCtlColor
) {
	HBRUSH hBrush = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
	if (pWnd == &m_stcALabel) {
		pDC->SetTextColor(RGB(0, 255, 0));
		pDC->SetBkMode(TRANSPARENT);
		return (HBRUSH)GetStockObject(NULL_BRUSH);
	}

	return hBrush;
}

void CDemoDlg::SetCurrentText(CWnd*pWnd, CString strText) {
	CRect rect;
	pWnd->GetWindowRect(rect);
	this->ScreenToClient(rect);
	pWnd->SetWindowText(strText);
	this->InvalidateRect(rect);
}

上一篇 程序版本控制

Comments

Content