Tom Bollich
March 29th, 1999, 10:06 AM
I need to take a CBitmap, write text on it,
and then get it back into a CBitmap, what
is the best way to do this? Right now I'm
doing:
CBitmap bitmap;
bitmap.LoadBitmap(IDB_BITMAP1);
//and then I create a CDC object:
CDC dcObj;
dcObj.CreateCompatibleDC(NULL);
dcObj.SelectObject(bitmap);
dcObj.TextOut(0,0, "Hi");
// now how exactly do I get it back out?
// I tried this:
CBitmap bitmap2;
bitmap2.CreateCompatibleBitmap(&dcObj, 10, 10);
// and all I get is a black background with
// a grey square in the middle which I think is 10x10
I also tried using the CDC.SelectObject to try to
get the bitmap out and I used GetCurrentBitmap, both
gave me back a grey bitmap. So could someone please
tell me how to do this, or maybe show me where I am
going wrong in my code? Oh and I am pretty new to
C++ and MFC so please speak slowly and with a lot of
big hand movements ;)
Thanks
and then get it back into a CBitmap, what
is the best way to do this? Right now I'm
doing:
CBitmap bitmap;
bitmap.LoadBitmap(IDB_BITMAP1);
//and then I create a CDC object:
CDC dcObj;
dcObj.CreateCompatibleDC(NULL);
dcObj.SelectObject(bitmap);
dcObj.TextOut(0,0, "Hi");
// now how exactly do I get it back out?
// I tried this:
CBitmap bitmap2;
bitmap2.CreateCompatibleBitmap(&dcObj, 10, 10);
// and all I get is a black background with
// a grey square in the middle which I think is 10x10
I also tried using the CDC.SelectObject to try to
get the bitmap out and I used GetCurrentBitmap, both
gave me back a grey bitmap. So could someone please
tell me how to do this, or maybe show me where I am
going wrong in my code? Oh and I am pretty new to
C++ and MFC so please speak slowly and with a lot of
big hand movements ;)
Thanks