![]() |
CXTPTabClientWnd and background image |
Post Reply
|
| Author | |
Cedric Caron
Newbie
Joined: 29 July 2006 Status: Offline Points: 13 |
Post Options
Thanks(0)
Quote Reply
Topic: CXTPTabClientWnd and background imagePosted: 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 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
|
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 31 August 2006 at 8:33am |
|
Hello,
Override CXTPTabClientWnd and its OnFillBackground.
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Cedric Caron
Newbie
Joined: 29 July 2006 Status: Offline Points: 13 |
Post Options
Thanks(0)
Quote Reply
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(); } |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 01 September 2006 at 11:45am |
|
Hello,
yes, right.
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Cedric Caron
Newbie
Joined: 29 July 2006 Status: Offline Points: 13 |
Post Options
Thanks(0)
Quote Reply
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());
|
|
![]() |
|
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 |