位图操作全攻略

1.http://www.ai86.cn/book/windows_programming/14.htm (位图操作) 

2.http://blog.csdn.net/jkflyfox/archive/2008/03/10/2164964.aspx (wince中显示PNG BMP GIF)

3.SHLoadImageFile 使用

OnDraw 片段:

CBitmap bitmap;

bitmap.Attach(SHLoadImageFile(L//My Documents//test.gif));

BITMAP bmpInfo;

bitmap.GetBitmap(&bmpInfo);

CDC bitmapDC:

bitmpaDC.CreateCompatibleDC(pDC);

CBitmap* pOldBitmap = bitmpaDC.SelectObject(&bitmap);

pDC->BitBlt(0,0,bmpInfo.bmWidth,bmpInfo.Height,&bitmapDC,0,0,SRCCOPY);

bitmapDC.SelectObject(pOldBitmap);

bitmap.DeleteObject();

4.http://blog.chinaunix.net/u/8600/showart.php?id=422501(强烈推荐wince上图片显示)

5.MFC 中使用SHLoadImageResource

如果在MFC中如果采用SHLoadImageResource来装载bmp jpg png

必须要打开.rc文件

然后编辑

IDR_SETTINGS_LOGO       GIF  DISCARDABLE                   "res//settings_logo.png"

GIF  DISCARDABLE 以前这里默认是 PNG 改过来就了 具体依据参考:http://msdn2.microsoft.com/en-us/library/bb416325.aspx Converts an image file in the resource file to a bitmap file. A resource image file should be coded in the resource file as follows (using BMP as an example): IDB_MYIMAGE_BMP GIF DISCARDABLE "MyImage.bmp". Note: Please note that the example resource line above correctly specifies GIF, even though the resource itself is actually a bitmap. GIF should be specified for all image resources, regardless of their format. Supplying any specifier other than GIF results in failure to load the image resource.

5.http://blog.csdn.net/91program/archive/2007/12/06/1920524.aspx (wince GIF动画显示)

6. Wince MFC中显示bmp位图。 在OnPaint中写以下代码:

void CXXXDlg::OnPaint() {  CBitmap   bmp;    bmp.LoadBitmap(IDB_BACKGRD_PIC);    CPaintDC   dc(this);    CDC   mem;    mem.CreateCompatibleDC(&dc);    CBitmap*   pOld=(CBitmap*)mem.SelectObject(&bmp);    BITMAP   bm;    bmp.GetBitmap(&bm);    //dc.BitBlt(0,0,bm.bmWidth,bm.bmHeight,&mem,0,0,SRCCOPY);//the same as origin  dc.StretchBlt(0,0,bm.bmWidth/*m_canvasW*/,/*m_canvasH*/bm.bmHeight,&mem,0,0,bm.bmWidth,bm.bmHeight,SRCCOPY);  mem.SelectObject(pOld);      CDialog::OnPaint(); }

 

7. 透明位图的实现

http://www.cppblog.com/QUIRE-0216/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值