Copying a CFont to a CBitmap

I was wondering if there is any way to blit a CFont to a CBitmap. Right now, I can use DrawText but that only outputs to a there any way to get the output of the drawtext to the CBitmap?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Create a memory DC and select the CBitmap into it.

// CBitmap bmp;


CBitmap *pOldBmp = MemDC.SelectObject(&bmp);

// MemDC.DrawText

cyberbumAuthor Commented:
When I do the DrawText, the bitmap ends up having a white rect in it...this is what I do:
      CDC dc;

            // Select the bitmap into the DC
            CBitmap * pOldBmp = dc.SelectObject(CBitmap::FromHandle(pImg->m_stImage.m_hBitmap));
            // Set Font
            CFont* pOldFont = dc.SelectObject(&m_fontFriends);
            // Set TextColor

            // DrawText
            dc.DrawText(pFriend->GetNickName(), &rectText, 0);

            // Cleanup

Also, where did you get your CMemDC class? I can't even construct mine without asserting..
cyberbumAuthor Commented:
Ok, it was my font color was the same as the background color:)
Add a comment so I can give you your points
Thank you.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.