MFC用CImage.Draw绘图对话框闪烁问题
这是一个应用程序类,想要在这个类实现绘制图像到窗体,还有这个类派生自CDialog
屏幕不到一秒闪烁一次,本人菜鸟,会的麻烦帮帮忙呵呵,小生在这谢谢了!
void Common::DrawFuncation(char *buf, int size)
{
CClientSystemDlg *pdlg = (CClientSystemDlg *)AfxGetMainWnd();
if(this->m_bDraw == true)
{
this->LockKeyMouse();
this->Show_Wnd();
int nWidth = GetSystemMetrics(SM_CXSCREEN);
int nHeight = GetSystemMetrics(SM_CYSCREEN);
IStream *I= NULL;
CreateStreamOnHGlobal(NULL,true, &I);
ULONG len;
I->Write((void *)buf,size,&len);
CImage image;
image.Load(I);
jpgWidth=image.GetWidth();
jpgHeight=image.GetHeight();
HDC hdcScreen;
hdcScreen = GetDC(pdlg->m_hWnd);
image.Draw(hdcScreen,0,0,nWidth,nHeight,0,0,jpgWidth,jpgHeight);
I->Release();
DeleteDC(hdcScreen);
}
}