« November 2005 »
S M T W T F S
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
You are not logged in. Log in

Programming Tips
Thursday, 10 November 2005
How to get the height and width of a bitmap?
Mood:  energetic
Topic: VC++
It's real easy to retrieve the height and width of a bitmap. Trust me, take a look.

CBitmap cbBmp;
cbBmp.LoadBitmap(IDB_BITMAPID);
BITMAP bmpInfo;
//clear bmpInfo
ZeroMemory(&bmpInfo, sizeof(bmpInfo));
cbBmp.GetBitmap(&bmpInfo);

There is another way of going about this. Take a look:

CBitmap cbBmp;
cbBmp.LoadBitmap(IDB_BITMAPID);
BITMAP bmpInfo;
//clear bmpInfo
ZeroMemory(&bmpInfo, sizeof(bmpInfo));
cbBmp.GetObject(sizeof(bmpInfo), &bmpInfo)

//now get the height and width...
int bmpHeight = bmpInfo.bmHeight;
int bmpWidth = bmpInfo.bmWidth;


See I told you it's easy.

Posted by Nibu babu thomas at 3:48 PM
Updated: Thursday, 10 November 2005 4:48 PM

View Latest Entries