Click here to Skip to main content
15,914,594 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to display a bitmap file using CBitmap class? Pin
Member 9541232-Apr-04 2:07
Member 9541232-Apr-04 2:07 
Generalpass through two level http proxy Pin
handle_cn1-Apr-04 18:34
handle_cn1-Apr-04 18:34 
Generalchar to Int conversion Pin
CNewbie1-Apr-04 17:50
CNewbie1-Apr-04 17:50 
GeneralRe: char to Int conversion Pin
alex12051-Apr-04 19:42
alex12051-Apr-04 19:42 
GeneralMemory Device context Pin
Member 9541231-Apr-04 17:39
Member 9541231-Apr-04 17:39 
GeneralRe: Memory Device context Pin
Prakash Nadar1-Apr-04 22:48
Prakash Nadar1-Apr-04 22:48 
GeneralRe: Memory Device context Pin
Member 9541232-Apr-04 1:59
Member 9541232-Apr-04 1:59 
GeneralRe: Memory Device context Pin
John R. Shaw2-Apr-04 10:57
John R. Shaw2-Apr-04 10:57 
1) Create 2 compatible device contexts: a DC (dcTemp) to temporarly hold current bitmap and a DC (dcOut) to hold the results of bliting.
2) Create a compatible bitmap large enough to hold all 5 bmp's.
3) Select large bitmap into dcOut. (save pOldOutBitmap here)
4) Select bitmap[0] into dcTemp. (save pOldBitmap here - need when finished)
5) Determine what position to blit bigmap to.
6) Blit bitmap[0] (dcTemp) to position in dcOut.
7) Select bitmap[1] into dcTemp.
8) Determine what position to blit bigmap to.
9) Blit bitmap[1] (dcTemp) to position in dcOut.
....
// Now all the bitmaps are in 1 DC.
N) Select pOldBitmap (dcTemp.SelectObject(pOldBitmap);).
N+1) Blit result to client area (pDC->BitBlt(...,&dcOut,...);).
N+2) Select pOldOutBitmap (dcTemp.SelectObject(pOldOutBitmap);).

That is all there is to it.

If you want to increase draw speed then you should create the large bitmap as a member variable and then create a function to copy, using above method, the 5 bitmaps to it. That way you do not need to do all the coping in the OnDraw function, just blit the stored bitmap to the client area.

If you want to you could create an array of bitmap IDs and use a loop to preform the repeated select, calc. position, and dcOut blits. That is how I whould do it, because then to add another bitmap all you need do is add its ID to the array.

Well I hope this helps.
Good Luck!


INTP
GeneralVisual c++ 6.0 bitmap moving Pin
Dimenser1-Apr-04 17:00
Dimenser1-Apr-04 17:00 
GeneralRe: Visual c++ 6.0 bitmap moving Pin
John R. Shaw2-Apr-04 11:10
John R. Shaw2-Apr-04 11:10 
Generalclosing a messagebox window Pin
bryce1-Apr-04 16:47
bryce1-Apr-04 16:47 
GeneralRe: closing a messagebox window Pin
Shog91-Apr-04 17:23
sitebuilderShog91-Apr-04 17:23 
GeneralRe: closing a messagebox window Pin
bryce1-Apr-04 17:28
bryce1-Apr-04 17:28 
GeneralRe: closing a messagebox window Pin
Shog91-Apr-04 17:37
sitebuilderShog91-Apr-04 17:37 
GeneralError C2440 on porting from VC6 to VC++.NET Pin
DionChen1-Apr-04 16:26
DionChen1-Apr-04 16:26 
GeneralWhat's header file with these function Pin
GflPower1-Apr-04 15:54
GflPower1-Apr-04 15:54 
GeneralRe: What's header file with these function Pin
Christian Graus1-Apr-04 16:16
protectorChristian Graus1-Apr-04 16:16 
GeneralDrop Down Menu Button in a CDialogBar Pin
+Ari+1-Apr-04 12:45
+Ari+1-Apr-04 12:45 
GeneralRe: Drop Down Menu Button in a CDialogBar Pin
John R. Shaw2-Apr-04 11:42
John R. Shaw2-Apr-04 11:42 
General3DES/ECB Mode Implementation Pin
Jeffrey Walton1-Apr-04 12:37
Jeffrey Walton1-Apr-04 12:37 
GeneralRe: 3DES/ECB Mode Implementation Pin
Alexander M.,1-Apr-04 22:57
Alexander M.,1-Apr-04 22:57 
GeneralMicrosoft SDK Pin
John R. Shaw1-Apr-04 12:11
John R. Shaw1-Apr-04 12:11 
GeneralRe: Microsoft SDK Pin
Harold Bamford1-Apr-04 12:18
Harold Bamford1-Apr-04 12:18 
GeneralRe: Microsoft SDK Pin
John R. Shaw1-Apr-04 12:27
John R. Shaw1-Apr-04 12:27 
GeneralRe: Microsoft SDK Pin
Gary R. Wheeler1-Apr-04 14:02
Gary R. Wheeler1-Apr-04 14:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.