Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Device Context Creation

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi

I need to create a device context called pGridDC which is 400 by 500 pixels big. I want to create this device context out of the OnDraw function. Therefore I cannot use pDC from the OnDraw function. The purpose of pGridDC is so I can BitBlt bitmaps in other DC's to it.

Can anyone please help?

Thank you
 
Hi,

What you can do is you can do a CreateCompatibleDC().
if you want to do it outside OnDraw() what you can do is you can go a
CDC* pDC = GetDC();

CDC dcMemory;
dcMemory.CreateCompatibleDC(pDC);
dcMemory.BitBlt(0,0,400,500,pointer to the device context from where you want to draw on the memory DC, 0, 0, SRCCPY);

more code to release the DC's

and finally pDC->ReleaseDC();

Hope this helps.

Thanx and Regards
Sun
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top