Create a CBitmap from a CDC ?
Hi,
I want to create a bitmap in memory from the contents of a device context held in memory, and I'm really struggling. Here's my CDC code :
Code:
CPaintDC dc(this); // device context for painting
m_sCaption = "Some text";
CFont font;
font.CreatePointFont(150, _T("Verdana"));
CDC memDC;
memDC.CreateCompatibleDC(&dc);
memDC.SetBkMode(TRANSPARENT);
memDC.SetTextColor(RGB(0, 0, 0));
memDC.SelectObject(&font);
memDC.TextOut(0, 0, m_sCaption);
CSize sz = memDC.GetTextExtent(m_sCaption);
// i now have my text in a device context, and i know the size of the image.
// what code do i add here to copy this into a bitmap ?
Thanks