![]() |
CWnd drawing background problem |
Post Reply ![]() |
Author | |
BastianPL ![]() Groupie ![]() ![]() Joined: 15 April 2006 Status: Offline Points: 69 |
![]() ![]() ![]() ![]() ![]() Posted: 24 April 2007 at 6:12am |
Hi,
I am creating a CWnd object in CView class. I would like to change a background colour of created window but my code doesn't work. Do you have any ideas how to resolve my problem: My code is: CWnd *pWnd = &m_wndClient; UINT nClassStyle = CS_CLASSDC | CS_SAVEBITS | CS_HREDRAW | CS_VREDRAW; BOOL bDropShadow; ::SystemParametersInfo( SPI_GETDROPSHADOW, 0, &bDropShadow, FALSE ); if ( bDropShadow ) nClassStyle |= CS_DROPSHADOW; CString szClassName = AfxRegisterWndClass( nClassStyle, 0, NULL, 0 ); pWnd->CreateEx( 0, szClassName, "", WS_VISIBLE | WS_CHILD | WS_BORDER, 200, 200, 400, 400, this->GetSafeHwnd(), 0, NULL ); CDC *pDC = pWnd->GetDC(); CBrush Brush; Brush.CreateStockObject( WHITE_BRUSH ); CRect r( 200, 200, 400, 400 ); CBrush *pOldBrush = pDC->SelectObject( &Brush ); pDC->Rectangle( r ); pDC->FillRect( &r, &Brush); pWnd->Invalidate(); pDC->SelectObject( pOldBrush ); Brush.DeleteObject(); |
|
Bastian
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
Override this CWnd and fill background in its WM_PAINT handler.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
BastianPL ![]() Groupie ![]() ![]() Joined: 15 April 2006 Status: Offline Points: 69 |
![]() ![]() ![]() ![]() ![]() |
I already done this.
Thanks
|
|
Bastian
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |