游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1428|回复: 3

加载位图,咋个走了样,怎么好像比原图大了。

[复制链接]

16

主题

62

帖子

62

积分

注册会员

Rank: 2

积分
62
发表于 2004-12-14 13:52:00 | 显示全部楼层 |阅读模式
pBitmap->m_hObject=(HBITMAP):oadImage(NULL,
                                                                                        "bground.bmp",
                                                                                        IMAGE_BITMAP,
                                                                                        rect.right,
                                                                                        rect.bottom,
                                                                                        LR_LOADFROMFILE);

÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷
void canvasFrame::OnPaint()
{
        CPaintDC dc(this); // device context for painting
       
        // TODO: Add your message handler code here     
        RECT rect;
        GetClientRect(&rect);
        dc.BitBlt(0,0,rect.right,rect.bottom,pMdc,0,0,SRCCOPY);
       
        // Do not call CFrameWnd::OnPaint() for painting messages
}
主要代码

sf_2004121413523.rar

111.3 KB, 下载次数:

63

主题

871

帖子

891

积分

高级会员

Rank: 4

积分
891
QQ
发表于 2004-12-14 14:34:00 | 显示全部楼层

Re:加载位图,咋个走了样,怎么好像比原图大了。

用原大小载入:
pBitmap->m_hObject=(HBITMAP):oadImage(NULL,
"bground.bmp",
IMAGE_BITMAP,
0,
0,
LR_LOADFROMFILE);

63

主题

871

帖子

891

积分

高级会员

Rank: 4

积分
891
QQ
发表于 2004-12-14 14:36:00 | 显示全部楼层

Re:加载位图,咋个走了样,怎么好像比原图大了。

BLT最好是这样的:
BitBlt(rect.left,rect.top,rect.right - rect.left,rect.bottom - rect.top,pMdc,0,0,SRCCOPY);

16

主题

62

帖子

62

积分

注册会员

Rank: 2

积分
62
 楼主| 发表于 2004-12-14 17:33:00 | 显示全部楼层

Re: 加载位图,咋个走了样,怎么好像比原图大了。

谢谢,谢谢。原来是这个参数,感谢战士顶起!

cxDesired
[in] Specifies the width, in pixels, of the icon or cursor. If this parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the function uses the SM_CXICON or SM_CXCURSOR system metric value to set the width. If this parameter is zero and LR_DEFAULTSIZE is not used, the function uses the actual resource width.
cyDesired
[in] Specifies the height, in pixels, of the icon or cursor. If this parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the function uses the SM_CYICON or SM_CYCURSOR system metric value to set the height. If this parameter is zero and LR_DEFAULTSIZE is not used, the function uses the actual resource height.
[em20]
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-12-23 16:32

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表