mobile 透明图片闪烁,
我尝试过用双缓冲,但是也没有解决! 不知道是哪里出错了! 那位大侠能帮我看下,闪烁问题没解决,而且图片的透明区域很乱
IImagingFactory *pImgFactory = NULL;
IImage *pImage = NULL;
CDC memdc; //使用双缓冲,解决闪烁问题
CRect rc(0,0,110,88);
memdc.CreateCompatibleDC(pDC);
CBitmap bmp;
bmp.CreateCompatibleBitmap(pDC,rc.Width(),rc.Height());
CBitmap *oldbmp=memdc.SelectObject(&bmp);
// Normally you would only call CoInitialize/CoUninitialize
// once per thread. This sample calls CoInitialize in this
// draw function simply to illustrate that you must call
// CoInitialize before calling CoCreateInstance.
CoInitializeEx(NULL, COINIT_MULTITHREADED);
// Create the imaging factory.
if (SUCCEEDED(CoCreateInstance (CLSID_ImagingFactory,
NULL,
CLSCTX_INPROC_SERVER,
IID_IImagingFactory,
(void **)&pImgFactory)))
{
// Load the image from the JPG file.
if (SUCCEEDED(pImgFactory->CreateImageFromFile(
TEXT("\\Program Files\\Imaging\\button.png"),
&pImage)))
{
// Draw the image.
pImage->Draw(memdc.m_hDC, &rc, NULL);
pImage->Release();
}
pImgFactory->Release();
}
CoUninitialize();
pDC->BitBlt(0,0,110,88,&memdc,0,0,SRCCOPY);
memdc.SelectObject(oldbmp);
memdc.DeleteDC();