当前位置: 代码迷 >> Windows Mobile >> mobile 透明图片闪耀
  详细解决方案

mobile 透明图片闪耀

热度:3802   发布时间:2013-02-26 00:00:00.0
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();

------解决方案--------------------------------------------------------
刚刚自己解决了....> 双缓冲对象不对,应该是在所有的绘图工作完成后在屏幕显示! 而我先将地图显示在将按钮双缓冲,就会出现描述的问题  
------解决方案--------------------------------------------------------
谢谢分享
  相关解决方案