打开程序时的初始化动画

//OnPaint
		CDC *pDC = GetDC();
		CDC *mdc, *bufdc;
		CBitmap *bmp, *bg, *poldbmp;
		mdc = new CDC;
		bufdc = new CDC;
		bmp = new CBitmap;
		bg = new CBitmap;
		bg->LoadBitmap(IDB_BITMAP1);
		bmp->CreateCompatibleBitmap(pDC, 850, 550);
		mdc->CreateCompatibleDC(pDC);
		bufdc->CreateCompatibleDC(pDC);
		mdc->SelectObject(bmp);
		poldbmp = (CBitmap *)bufdc->SelectObject(bg);
		for (int i = 0; i<50; i++)
		{
			for (int j = i; j<850; j = j + 50)
			{
				mdc->BitBlt(j, 0, 1,850, bufdc, j, 0, SRCCOPY);
			}
			pDC->BitBlt(0, 0, 850, 550, mdc, 0, 0, SRCCOPY);
			Sleep(30);
		}
		bufdc->SelectObject(poldbmp);
		Sleep(1500);
		ReleaseDC(pDC);
		bmp->DeleteObject();
		mdc->DeleteDC();
		bufdc->DeleteDC();
		delete mdc;
		delete bufdc;
		delete bmp;
		delete bg;
		Invalidate(true);

、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
/*
		从天而降
		for (int ySrc = bm.bmHeight; ySrc >= 0; ySrc -= 10)
		{
			pDC.BitBlt(0, 0, bm.bmWidth, bm.bmHeight, &dcMem, 0, ySrc, SRCCOPY);
			Sleep(50);
		}*/
		/*
		从左往右
		for (int xSrc = bm.bmWidth; xSrc >= 0; xSrc -= 10)
		{
			pDC.BitBlt(0, 0, bm.bmWidth, bm.bmHeight, &dcMem, xSrc, 0, SRCCOPY);
			Sleep(50);
		}*/
		/*
		从上展开
		for (int htDes = 0; htDes <= bm.bmHeight; htDes += 10)
		{
			pDC.BitBlt(0, 0, bm.bmWidth, htDes, &dcMem, 0, 0, SRCCOPY);
			Sleep(50);
		}*/
		/*从左展开
		for (int wtDes = 0; wtDes <= bm.bmWidth; wtDes += 10)
		{
			pDC.BitBlt(0, 0, wtDes, bm.bmHeight, &dcMem, 0, 0, SRCCOPY);
			Sleep(50);
		}*/
		/*水平百叶窗
		int n = bm.bmHeight / 8;
		for (int htDes = 0; htDes <= n; htDes += 1)
		{
			for (int i = 0; i < 8; i++)
			{
				pDC.BitBlt(0, n * i, bm.bmWidth, htDes, &dcMem, 0, n * i, SRCCOPY);
			}
			Sleep(50);
		}
		*/
		/*垂直百叶窗
		int n = bm.bmWidth / 8;
		for (int wtDes = 0; wtDes <= n; wtDes += 1)
		{
			for (int i = 0; i < 8; i++)
			{
				pDC.BitBlt(n * i, 0, wtDes, bm.bmHeight, &dcMem, n * i, 0, SRCCOPY);
			}
			Sleep(50);
		}*/
		/*由小变大
		float x, y, w, h;
		float base = 0;
		pDC.SetStretchBltMode(HALFTONE);
		while ((int)(base += 15) <= rc.Width())
		{
			w = base;
			h = base * ((float)bmp.bmHeight / (float)bmp.bmWidth);
			x = (float)rc.Width()/2 -w/2;
			y = (float)rc.Height()/2  - h/2 ;

			if (rc.Width() - base >= 0 && rc.Width() - base <= 15) //保证最后一次画的时候能铺满
			{
				base = rc.Width();
				x = y = 0;
				w = rc.Width();
				h = rc.Height();
			}
			dc.StretchBlt((int)x, (int)y, (int)w, (int)h, &memdc, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY);
		}*/

}


你可能感兴趣的:(MFC)