关于得到bitmap的高和宽!

fantasychina 2006-04-22 01:33:52
我用
HBITMAP hBitmap=(HBITMAP)::LoadImage(NULL,"map.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE)
加载位图,怎样得到位图的宽和高呢?我用GetBitmapDimentionEx()得到的是0,0 .我想知道还有其他的方法得到高和宽?不用MFC及其其他类库,只通过win32 API途径.谢谢!
...全文
170 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
yanghy2013 2006-04-22
  • 打赏
  • 举报
回复
CBitmap bitmapSpan;
BITMAP BitMapInf;

bitmapSpan.LoadBitmap(IDB_COLUMNHEADER_SPAN);
bitmapSpan.GetObject(sizeof(BitMapInf),&BitMapInf);
其中BitMapInf.bmWidth,BitMapInf.bmHeight就是这图片的宽和高
菜牛 2006-04-22
  • 打赏
  • 举报
回复
从文件中直接读取位图信息就可以了。
ReadFile
BITMAPINFO
sycnick 2006-04-22
  • 打赏
  • 举报
回复
CBitmap::GetBitmapDimension

Returns the width and height of the bitmap.

CSize GetBitmapDimension( ) const;

Return Value
The width and height of the bitmap, measured in 0.1-millimeter units. The height is in the cy member of the CSize object, and the width is in the cx member. If the bitmap width and height have not been set by using SetBitmapDimension, the return value is 0.

Remarks
The height and width are assumed to have been set previously by using the SetBitmapDimension member function.

city_freeman 2006-04-22
  • 打赏
  • 举报
回复
CBitmap bitmapSpan;
BITMAP szBitMap;

bitmapSpan.LoadBitmap(IDB_COLUMNHEADER_SPAN);
bitmapSpan.GetObject(sizeof(BITMAP),&szBitMap);
CSize size(szBitMap.bmWidth,szBitMap.bmHeight);

15,975

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧