Article View: cn.bbs.comp.program
Article #1096VC FAQ(9)
From: �ϵ�
Date: Sun, 19 Apr 1998 00:00
Date: Sun, 19 Apr 1998 00:00
95 lines
2652 bytes
2652 bytes
2m������:m TMN (������)
2m�� ��:m RAD
2m�� ��:m VC FAQ(9)
2m����վ:m '3m�Ͻ�ɺ�m' (Wed Apr 8 08:16:20 1998) , 5mվ���ż�m
[������ҳ] [����������] [ȫ��������]
--------------------------------------------------
How change the background color of a view?
--------------------------------------------------
To change the background color for a CView, CFrameWnd, or CWnd object,
process
the WM_ERASEBKGND message. The following code shows how:
BOOL CSampleView::OnEraseBkgnd(CDC* pDC)
{
// Set brush to desired background color
CBrush backBrush(RGB(255, 128, 128));
// Save old brush
CBrush* pOldBrush = pDC->SelectObject(&backBrush);
CRect rect;
pDC->GetClipBox(&rect); // Erase the area needed
pDC->PatBlt(rect.left, rect.top, rect.Width(),
rect.Height(), PATCOPY);
pDC->SelectObject(pOldBrush);
return TRUE;
}
I solved the problem like this->
HBRUSH dlgtest::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
switch (nCtlColor)
{
case CTLCOLOR_BTN:
case CTLCOLOR_STATIC:
{
pDC->SetBkMode(TRANSPARENT);
}
case CTLCOLOR_DLG:
{
CBrush* back_brush;
COLORREF color;
color = (COLORREF) GetSysColor(COLOR_BTNFACE);
back_brush = new CBrush(color);
return (HBRUSH) (back_brush->m_hObject);
}
}
return(CFormView::OnCtlColor(pDC, pWnd, nCtlColor));
}
Tim, tfiner@vrli.com, email, 9/10/95
[������ҳ] [����������] [ȫ��������]
--
m;31m�� ��Դ:���Ͻ�ɺ� bbs.njupt.edu.cn��[FROM: pc05.info.njupt]m
--
[m[1;33m�� ��Դ:���ϴ�С�ٺ���Ϣ����վ bbs.nju.edu.cn��[FROM: a507yjh.nju.edu][m
Technical Details
Message-ID:
<3OAiUY$tP2@bbs.nju.edu.cn>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: fc86e,233a1fc804171552,start X-Google-Attributes: gidfc86e,public From: mendy.bbs@bbs.nju.edu.cn (�ϵ�) Subject: VC FAQ(9) Date: 1998/04/19 Message-ID: <3OAiUY$tP2@bbs.nju.edu.cn> X-Deja-AN: 345966151 X-Filename: Programming/M.893022658.A Organization: nju_bbs Newsgroups: cn.bbs.comp.program