How to place a Bitmap in the center of a Cdocument document on startup
-
How to place a Bitmap in the center of a Cdocument document on startup? If tried to find it in codeproject and MSDN but neither shows what I want. I want to place the Bitmap in the center of the document when the program loads(opens). could someone show me code for doing this in MFC? Please. Thanks in advance. The ID of the Bitmap is IDB_FRACTK. A C++ programming language novice, but striving to learn
-
How to place a Bitmap in the center of a Cdocument document on startup? If tried to find it in codeproject and MSDN but neither shows what I want. I want to place the Bitmap in the center of the document when the program loads(opens). could someone show me code for doing this in MFC? Please. Thanks in advance. The ID of the Bitmap is IDB_FRACTK. A C++ programming language novice, but striving to learn
Look around for a "splash screen" (here or using google...), is that what you mean?
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <
-
Look around for a "splash screen" (here or using google...), is that what you mean?
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <
No this is NOT what I'm looking for. I once saw an article that displayed a Bitmap in the CDocument/View interface, but I've lost it somehow. I'll keep hoping someone has one and meanwhile I'll keep looking.
A C++ programming language novice, but striving to learn
-
No this is NOT what I'm looking for. I once saw an article that displayed a Bitmap in the CDocument/View interface, but I've lost it somehow. I'll keep hoping someone has one and meanwhile I'll keep looking.
A C++ programming language novice, but striving to learn
I'm still not sure what you mean but...did you try overwriting the OnPaint method of your view class (or OnDraw maybe?) and do something like this:
CBitmap bitmap;
bitmap.LoadBitmap(IDB_WHATEVER);
CDC MemDC;
MemDC.CreateCompatibleDC(&dc_of_view);
CBitmap *originalBitmap = MemDC.SelectObject(&bitmap);
BITMAP bitmapInfo;
bitmap.GetBitmap(&bitmapInfo);
CRect Rect;
GetClientRect(&Rect)
dc.BitBlt(Rect.CenterPoint().x - bitmapInfo.bmWidth / 2,
Rect.CenterPoint().y - bitmapInfo.bmHeight / 2,
bitmapInfo.bmWidth,
bitmapInfo.bmHeight,
&MemDC,
0,
0,
SRCCOPY);
MemDC.SelectObject(originalBitmap);> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <
-
I'm still not sure what you mean but...did you try overwriting the OnPaint method of your view class (or OnDraw maybe?) and do something like this:
CBitmap bitmap;
bitmap.LoadBitmap(IDB_WHATEVER);
CDC MemDC;
MemDC.CreateCompatibleDC(&dc_of_view);
CBitmap *originalBitmap = MemDC.SelectObject(&bitmap);
BITMAP bitmapInfo;
bitmap.GetBitmap(&bitmapInfo);
CRect Rect;
GetClientRect(&Rect)
dc.BitBlt(Rect.CenterPoint().x - bitmapInfo.bmWidth / 2,
Rect.CenterPoint().y - bitmapInfo.bmHeight / 2,
bitmapInfo.bmWidth,
bitmapInfo.bmHeight,
&MemDC,
0,
0,
SRCCOPY);
MemDC.SelectObject(originalBitmap);> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <
Yes, that's exactly what I was looking for. Question?: everytime the bitmap gets covered what command do I use to redraw it? (UpdateWindow??)
A C++ programming language novice, but striving to learn
-
Yes, that's exactly what I was looking for. Question?: everytime the bitmap gets covered what command do I use to redraw it? (UpdateWindow??)
A C++ programming language novice, but striving to learn
Once again i am not sure what exactly do you mean but to trigger redrawing of your view you can either use RedrawWindow[^] or InvalidateRect[^] (maybe in conjunction with UpdateWindow right after).
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <
-
Once again i am not sure what exactly do you mean but to trigger redrawing of your view you can either use RedrawWindow[^] or InvalidateRect[^] (maybe in conjunction with UpdateWindow right after).
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <
Thanks again.
A C++ programming language novice, but striving to learn