📄 flashwnd.cpp
字号:
// FlashWnd.cpp : implementation file
//
#include "stdafx.h"
#include "CarLP.h"
#include "FlashWnd.h"
#include "Resource.h"
#include "ximage.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFlashWnd
CFlashWnd::CFlashWnd()
{
//装载位图
for(int i=0; i<2; i++)
hBMP[i] = ::LoadBitmap(AfxGetApp()->m_hInstance,MAKEINTRESOURCE(IDB_BITMAP1+i));
//获取位图信息
::GetObject( hBMP[0], sizeof( BITMAP), (LPVOID)&bm) ;
}
CFlashWnd::~CFlashWnd()
{
}
BEGIN_MESSAGE_MAP(CFlashWnd, CWnd)
//{{AFX_MSG_MAP(CFlashWnd)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFlashWnd message handlers
void CFlashWnd::OnPaint()
{
// CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
RECT rc;
CBitmap* pBmpOld;
CClientDC dc(this);
m_MemDC.CreateCompatibleDC(&dc);
m_bitmap.CreateCompatibleBitmap(&dc,3*bm.bmWidth,bm.bmHeight);
// ::MessageBox(NULL,"OnPaint--1","Tips",MB_OK);
pBmpOld = m_MemDC.SelectObject(&m_bitmap);
// ::MessageBox(NULL,"OnPaint--2","Tips",MB_OK);
CxImage* pCx;
for(int j=0; j<4; j++)
{
for(int i=0; i<2; i++)
{
pCx = new CxImage();
pCx->CreateFromHBITMAP(hBMP[i]);
rc.left = i*bm.bmWidth;
rc.top = 0;
rc.bottom = bm.bmHeight;
rc.right = (i+1)*bm.bmWidth;
pCx->Draw(m_MemDC.m_hDC,rc);
// ::MessageBox(NULL,"OnPaint--3","Tips",MB_OK);
dc.StretchBlt(0,
0,
4*bm.bmWidth,
4*bm.bmHeight,
&m_MemDC,
i*bm.bmWidth,
0,
bm.bmWidth,
bm.bmHeight,
SRCCOPY);
Sleep(200);//
// ::MessageBox(NULL,"OnPaint--4","Tips",MB_OK);
delete pCx;
}
}
// ::MessageBox(NULL,"OnPaint--5","Tips",MB_OK);
m_MemDC.SelectObject(pBmpOld);
// Do not call CWnd::OnPaint() for painting messages
}
void CFlashWnd::ShowFlash()
{
CFlashWnd* pFW = new CFlashWnd;
pFW->CreateFlash();
pFW->CenterWindow();
pFW->ShowWindow(SW_SHOW);
pFW->UpdateWindow();//Flash在OnPaint()消息中处理
// ::MessageBox(NULL,"OnPaint--5","Tips",MB_OK);
pFW->DestroyWindow();
delete pFW;
}
void CFlashWnd::CreateFlash()
{
//Create Splash Window
CreateEx(0,
AfxRegisterWndClass(
0,
AfxGetApp()->LoadStandardCursor(IDC_ARROW)),
"FlashWindow",
WS_POPUP,
0,
0,
4*bm.bmWidth, //Bitmap Width = Splash Window Width
4*bm.bmHeight, //Bitmap Height = Splash Window Height
NULL,
NULL,
NULL);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -