码迷,mamicode.com
首页 > 编程语言 > 详细

mfc中循环显示图片

时间:2015-01-14 06:20:17      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:

UINT CPalmIdentDlg::UpdateCImg(LPVOID p)
{
        struct params *pa = (struct params*)p;
        int *imgarray = pa->imgArray;
        CStatic *m_StaticCImg = pa->ImgCtrl;
        int *count = (pa->count);
        //CDC* pdc = pa->pdc;
        //if (pdc==NULL) AfxMessageBox(_T("erro"));
        
        CRect rect;
        m_StaticCImg->GetClientRect(&rect);
        CDC dcMem;
        dcMem.CreateCompatibleDC(m_StaticCImg->GetDC());

        CBitmap appBgImage;
        BITMAP    bitmapInfo;
        while(1)
        {
            
            
            if (*count < 16)
            {
                appBgImage.Detach();
                appBgImage.LoadBitmap(imgarray[*count]);
                *count = *count +1;
            }
            else 
            {
                *count = 0;
            }
            
            appBgImage.GetBitmap(&bitmapInfo);
            dcMem.SelectObject(&appBgImage);
            m_StaticCImg->GetDC()->StretchBlt(0, 0, 100, 100, &dcMem, 0, 0, bitmapInfo.bmWidth, bitmapInfo.bmHeight, SRCCOPY);
            //dcMem.Detach();
            //appBgImage.DeleteObject();
            Sleep(150);
        }
        dcMem.DeleteDC();
        return 0;
}

 

 

 

mfc中线程相关操作:

http://www.360doc.com/content/14/0218/12/7267612_353478380.shtml

mfc中循环显示图片

标签:

原文地址:http://www.cnblogs.com/sunniflyer/p/4223032.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!