MFC软件版本信息Bitmap格式

void CAppInfo::ShowAppInfo(CWnd *parent)
{
	if (m_pWnd == NULL)
	{
		m_pWnd = new CAppInfo();
	}

	if (m_pWnd->Create(parent))
	{
		m_pWnd->UpdateWindow();
	} 

}

BOOL CAppInfo::Create(CWnd *parent)
{
	if (!m_bitmap.LoadBitmap(IDB_SPLASH))
	{
		return FALSE;
	}
	BITMAP bt;
	m_bitmap.GetBitmap(&bt);
	CreateEx(0, AfxRegisterWndClass(0, AfxGetApp()->LoadStandardCursor(IDC_ARROW)),
		NULL, WS_POPUP | WS_VISIBLE, CRect(0, 0, bt.bmWidth, bt.bmHeight), 
		parent,0);

	return TRUE;
}

int CAppInfo::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// TODO: Add your specialized creation code here


	SetTimer(1, 3000, 0);
	return 0;
}

void CAppInfo::OnPaint() 
{
	CPaintDC pDC(this); // device context for painting
	
	// TODO: Add your message handler code here
	CDC cDC;
	BITMAP bt;
	m_bitmap.GetBitmap(&bt);
	cDC.CreateCompatibleDC(&pDC);
	CBitmap *poldBt = (CBitmap *)cDC.SelectObject(&m_bitmap);
	pDC.BitBlt(0, 0, bt.bmWidth, bt.bmHeight, &cDC, 0, 0, SRCCOPY);
	cDC.SelectObject(poldBt);

	CRect rt1, rt2;
	GetParent()->GetWindowRect(&rt1);
	rt2.left = rt1.left + (rt1.Width()-bt.bmWidth)/2;
	rt2.right = rt2.left +bt.bmWidth;
	rt2.top = rt1.top + (rt1.Height()-bt.bmHeight)/2;
	rt2.bottom = rt2.top + bt.bmHeight;
	MoveWindow(&rt2);
	// Do not call CWnd::OnPaint() for painting messages
}

void CAppInfo::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	HideInfo();	
}

//DEL void CAppInfo::OnNcDestroy() 
//DEL {
//DEL 	delete this;
//DEL 	m_pWnd = NULL;
//DEL 	CWnd::OnNcDestroy();
//DEL 	
//DEL 	// TODO: Add your message handler code here
//DEL }

void CAppInfo::PostNcDestroy() 
{
	// TODO: Add your specialized code here and/or call the base class
	delete this;
	m_pWnd = NULL;
}

BOOL CAppInfo::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
	
	if (m_pWnd == NULL)
		return FALSE;
	
	// If we get a keyboard or mouse message, hide the splash screen.
	if (pMsg->message == WM_KEYDOWN ||
		pMsg->message == WM_SYSKEYDOWN ||
		pMsg->message == WM_LBUTTONDOWN ||
		pMsg->message == WM_RBUTTONDOWN ||
		pMsg->message == WM_MBUTTONDOWN ||
		pMsg->message == WM_NCLBUTTONDOWN ||
		pMsg->message == WM_NCRBUTTONDOWN ||
		pMsg->message == WM_NCMBUTTONDOWN)
	{
		m_pWnd->HideInfo();
		return TRUE;
		// message handled here
	}
	return FALSE;
}

void CAppInfo::HideInfo()
{
	DestroyWindow();
	AfxGetMainWnd()->UpdateWindow();
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值