本文介绍了StretchBlt MFC C ++问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!我使用StretchBlt 加载位图图像并将其显示在屏幕上.
我还在基于对话框的应用程序中使用了双缓冲区.

我写了一个显示图像的函数:

Hello! I use StretchBlt to load bitmap image and show it on screen.
I also use double buffer in my application, which is dialog based.

I wrote a function that displays the image:

void CPlay::OnBackground(CBitmap* p, CDC* pDC)
{
    CDC dcMemory;
    BITMAP bm;
    dcMemory.CreateCompatibleDC(pDC);
    dcMemory.SelectObject(p);
    p->GetBitmap(&bm);

	pDC->StretchBlt(0, 0, screenX, screenY, &dcMemory, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
}



然后,使CBitmap 变量并加载图像:



Then I make CBitmap variable and load the image:

variable.LoadBitmap(RESOURCE);



我称这个功能OnBackground(&variable, &pDC);
pDC 是CDC变量;
screenXscreenY 是我的屏幕分辨率:



I call the function OnBackground(&variable, &pDC);
pDC is CDC variable;
screenX, screenY are my screen resolution:

	screenX = GetSystemMetrics(SM_CXSCREEN);
	screenY = GetSystemMetrics(SM_CYSCREEN);



如果我保留我的分辨率(1280x1024),则效果很好.但是,如果我更改它,我的CPU开始使用50-60%,并且速度变慢.
如果我使用StretchBlt错误,请通知我.
希望您能明白我的意思,这就是为什么我以前会详细写它的原因.谢谢!



If I keep my resol(1280x1024), it works well. But if I change it, my CPU starts using 50-60% and it is slowed down.
If I''m wrong using StretchBlt, please let me know.
I hope you can get my point, that''s why I used to write it in a detailed manner.
Thanks!

推荐答案




这篇关于StretchBlt MFC C ++问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 01:13