Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CXTPTabClientWnd and background image
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPTabClientWnd and background image

 Post Reply Post Reply
Author
Message
Cedric Caron View Drop Down
Newbie
Newbie


Joined: 29 July 2006
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote Cedric Caron Quote  Post ReplyReply Direct Link To This Post Topic: CXTPTabClientWnd and background image
    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 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
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 31 August 2006 at 8:33am
Hello,
Override CXTPTabClientWnd  and its OnFillBackground.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Cedric Caron View Drop Down
Newbie
Newbie


Joined: 29 July 2006
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote Cedric Caron Quote  Post ReplyReply Direct Link To This Post 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();

}

Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 01 September 2006 at 11:45am
Hello,
 
yes, right.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Cedric Caron View Drop Down
Newbie
Newbie


Joined: 29 July 2006
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote Cedric Caron Quote  Post ReplyReply Direct Link To This Post 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());
 
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.047 seconds.