⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 startupdlg.cpp

📁 校园导游系统
💻 CPP
字号:
// StartUpDlg.cpp : implementation file
//

#include "stdafx.h"
#include "newguide.h"
#include "StartUpDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CStartUpDlg dialog


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


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


BEGIN_MESSAGE_MAP(CStartUpDlg, CDialog)
	//{{AFX_MSG_MAP(CStartUpDlg)
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CStartUpDlg message handlers

//DEL void CStartUpDlg::OnStartup() 
//DEL {
//DEL 	// TODO: Add your control notification handler code here
//DEL 	
//DEL     OnOK();
//DEL 
//DEL }

void CStartUpDlg::CGPushDialogFromCenter(CDialog &dlg)
{
	dlg.ShowWindow(SW_HIDE); 
    CRect rect; 
    dlg.GetClientRect(&rect); 
    CPoint ptCenter; 
    ptCenter.x = rect.Width()/2; 
    ptCenter.y = rect.Height()/2; 
    int m = ::GetSystemMetrics(SM_CYSIZEFRAME); 
    //dianamic pop the dlg
    CRgn rgn; 
    for (int i = 5; i < rect.Width()/2 + 8*m; i += 1) 
    { 
        rgn.CreateRectRgn(ptCenter.x - i, ptCenter.y - i, ptCenter.x + i, ptCenter.y + i); 
        dlg.SetWindowRgn((HRGN)rgn, TRUE); 
        dlg.ShowWindow(SW_SHOW); 
        dlg.CenterWindow(); 
        rgn.DeleteObject(); 
    } 	
}

BOOL CStartUpDlg::OnInitDialog()
{
	CGPushDialogFromCenter(*this); //动态爆炸式推出窗口! 
	return true;
}

CSize GetBitmapSize(const CBitmap&bitmap);

void CStartUpDlg::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
	CRect rectClip,rectTile;
	CDC dcMem,*pDC;
    CBitmap bmBackground;
    bmBackground.LoadBitmap(IDB_BITMAP8); 	//IDB_BG为背景图ID
	
	  //背景尺寸
	  
		CSize sizeBg =GetBitmapSize(bmBackground);	
		pDC = GetDC(); 
		dcMem.CreateCompatibleDC(pDC);
		CBitmap *pbmOld=dcMem.SelectObject(&bmBackground);
		
		  pDC->GetClipBox(&rectClip);    
		  rectTile=CRect(0,0,sizeBg.cx,sizeBg.cy);
		  while (rectTile.top<=rectClip.bottom)
		  {
		  while (rectTile.left<=rectClip.right)
		  {
		  if (!(rectTile & rectClip).IsRectEmpty())				
		  pDC->BitBlt(rectTile.left,rectTile.top, sizeBg.cx,sizeBg.cy,&dcMem,
		  0,0,SRCCOPY);
		  rectTile.left+=sizeBg.cx;
		  rectTile.right+=sizeBg.cx;
		  }
		  rectTile.left=0; rectTile.right=sizeBg.cy;
		  rectTile.top+=sizeBg.cy; rectTile.bottom+=sizeBg.cy;
		  }
		  dcMem.SelectObject(pbmOld);
	dcMem.DeleteDC();
	// Do not call CDialog::OnPaint() for painting messages
}

⌨️ 快捷键说明

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