coverdlg.cpp

来自「一种新颖的软件启动画面与鸣谢画面的编程实现」· C++ 代码 · 共 105 行

CPP
105
字号
// CoverDlg.cpp : implementation file
//

#include "stdafx.h"
#include "mysplash.h"
#include "CoverDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CCoverDlg dialog


CCoverDlg::CCoverDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CCoverDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CCoverDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CCoverDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCoverDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CCoverDlg, CDialog)
	//{{AFX_MSG_MAP(CCoverDlg)
	ON_WM_TIMER()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCoverDlg message handlers
BOOL CCoverDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	CRect rect1;   
    GetClientRect(&rect1); 
	y=rect1.Height();
    m_MemBitmap.init(this);  
    SetTimer(1,20,NULL);    
 
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CCoverDlg::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
  CRect   rect;    
  CDC*    pDC = GetDC();
  CDC     dcComp;
  this->GetClientRect(&rect); 
  y--;  
  m_MemBitmap.Clear( rect.left, rect.top, rect.right, rect.bottom, RGB(200,100,150) ); 
  m_MemBitmap.TextOut(15,y,180,  " 火电厂厂级负荷优化控制系统 ",RGB(0,250,0));  
  m_MemBitmap.TextOut(10,y+30,120, "===========================================",RGB(0,0,250)); 
  m_MemBitmap.TextOut(10,y+60,120, "授权人: 王治国 ",RGB(0,250,0));   
  m_MemBitmap.TextOut(10,y+90,120, "授权人单位:华北电力大学控制科学与工程学院 ",RGB(0,250,0)); 
  m_MemBitmap.TextOut(10,y+120,120,"Version 6.0 Copyright@2004",RGB(0,250,0)); 
  m_MemBitmap.TextOut(10,y+150,120,"===========================================",RGB(0,0,250));
  m_MemBitmap.TextOut(60,y+180,150, "尊重知识产权,请使用正版!",RGB(250,0,0));
  dcComp.CreateCompatibleDC(pDC); 
  dcComp.SelectObject(&m_MemBitmap); 
  //内存设备环境将位图对象选入 
  pDC->BitBlt(0, 0, rect.Width() , rect.Height(),  &dcComp,  0,0,SRCCOPY);    
  //用位传输函数显示出来
  dcComp.DeleteDC();    
  ReleaseDC(pDC);    
  //释放设备对象
  if(y<=-180)
  { 
     KillTimer(1);
	 CDialog::OnCancel();
	 //文字显示完后,退出!
  }

  CDialog::OnTimer(nIDEvent);
}
LRESULT CCoverDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) 
{
 if ( message == WM_KEYDOWN ||message == WM_SYSKEYDOWN ||
   message == WM_LBUTTONDOWN ||message == WM_RBUTTONDOWN ||
   message == WM_MBUTTONDOWN ||message == WM_NCLBUTTONDOWN ||
   message == WM_NCRBUTTONDOWN ||message == WM_NCMBUTTONDOWN )
 {//如有事件发生,退出!
      
	  KillTimer(1);
	  CDialog::OnCancel();
      return TRUE; 
 }
  return CWnd::WindowProc(message, wParam, lParam);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?