views:

39

answers:

1

Hi,

I am loading background image at runtime in my MFC Application. Like this :

m_objMainScrnDC.CreateCompatibleDC(NULL);
        m_objMainScrnBgBitmap.LoadBitmap(IDB_MAIN_SCRN_BG); 

And i have tabcontrol on my page at design time , now i want to place a background image for tab control at runtime but i am not able to get that image The tabcontrol is on top of background image which i have loaded at run time.

    m_objTabDC.CreateCompatibleDC(NULL);
m_objTabBitmap.LoadBitmap(IDB_TAB_BG);

How i can achieve this ?

A: 

My MFC is pretty rusty, but I think I remember that it involved creating a brush with your image and having MFC use it when the window gets redrawn (was it OnPaint()? OnRedraw()?).

I googled a bit and found this: http://www.codeproject.com/KB/MFC/UltimateToolbox_Skins.aspx Not exactly what you want, but the source is there and I'm sure it can lead you in the right direction. Also, if it looks like "too much work just to get a background image" then you're right. MFC did so little for programmers out of the box that every simple thing required a ton of work and effort on our part.

enriquein
@enriquein :OnPaint()
Swapnil Gupta