Print Page | Close Window

CXTPTabClientWnd and background image

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=4929
Printed Date: 11 November 2025 at 2:41am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPTabClientWnd and background image
Posted By: Cedric Caron
Subject: CXTPTabClientWnd and background image
Date Posted: 30 August 2006 at 10:35pm
I use the code described on this page http://www.codeguru.com/forum/archive/index.php/t-319786.html - http://www.codeguru.com/forum/archive/index.php/t-319786.html to add a background image in my software and this solution is working fine if i don't use CXTPTabClientWnd in my software.
 
But if I use CXTPTabClientWnd  the attach function faile to subclass m_hWndMDIClient which is already subclassed by my background painter.
 
How can I safley add a background image to an aplication using CXTPTabClientWnd   ?
 
Thanks for your help
 
Cédric



Replies:
Posted By: Oleg
Date Posted: 31 August 2006 at 8:33am
Hello,
Override CXTPTabClientWnd  and its OnFillBackground.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Cedric Caron
Date Posted: 31 August 2006 at 7:28pm

Thanks it is working fine.

Aditionaly to OnFillBackground I overrided OnSize to force a full redraw of the background and resize my image
 

afx_msg void CMDIClientWnd::OnSize(UINT nType, int cx, int cy)

{

CXTPTabClientWnd::OnSize(nType, cx, cy);

Invalidate();

}



Posted By: Oleg
Date Posted: 01 September 2006 at 11:45am
Hello,
 
yes, right.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Cedric Caron
Date Posted: 01 September 2006 at 5:22pm

aditional info if you try to do the same in your application:

I tester GDI and GDI+ to display my background image. GDI+ is faster give a beter result and requiere less coding.
 
GDI:
 
CDC cdc;
cdc.CreateCompatibleDC(pDC);
CBitmap * pOldBmp = cdc.SelectObject(&m_bmpBackground);
BITMAP bmp;
m_bmpBackground.GetBitmap(&bmp);
pDC->StretchBlt(rc.left, rc.top, rc.right, rc.bottom, &cdc, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY);
cdc.SelectObject(pOldBmp);
 
GDI+:
 
Graphics gfx(*pDC);
Bitmap bmp(AfxGetResourceHandle(), (WCHAR *)MAKEINTRESOURCE(IDB_BACKGROUND));
gfx.DrawImage(&bmp, rc.left, rc.top, rc.Width(), rc.Height());
 



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net