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

📄 hpmessagebox.cpp

📁 一个mapxmobile+gps的小程序,需要先安装mapx mobile
💻 CPP
字号:
// HPMessageBox.cpp : implementation file
//

#include "stdafx.h"
#include "HPMessageBox.h"

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

CHPMessageBox::CHPMessageBox()
{
	m_MessageHead = _T("消息:");
	m_MessageBody = _T("无");
	bCurrentIsShow = true;
}

CHPMessageBox::~CHPMessageBox()
{
}

BEGIN_MESSAGE_MAP(CHPMessageBox, CGISSymble)
	//{{AFX_MSG_MAP(CHPMessageBox)
	ON_WM_TIMER()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

void CHPMessageBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) 
{
	CGISSymble::DrawItem(lpDrawItemStruct);
	CDC dc;
	dc.Attach(lpDrawItemStruct->hDC );
	dc.SetBkMode(TRANSPARENT);
	dc.ExtTextOut(5,7,ETO_OPAQUE,NULL,m_MessageHead,m_MessageHead.GetLength(),NULL);
	dc.ExtTextOut(40,7,ETO_OPAQUE,NULL,m_MessageBody,m_MessageBody.GetLength(),NULL);
	dc.Detach();
}

void CHPMessageBox::OnTimer(UINT nIDEvent) 
{
	switch(nIDEvent)
	{
	case 1:
		{
			static int n=TOP_START;
			::MoveWindow(m_hWnd, 0, n-- , m_nWidth, m_nHeight, FALSE);
			if( n == BOT_START )
			{
				KillTimer(1);
				n=TOP_START;
				bCurrentIsShow = true;
			}
			break;
		}
	case 2:
		{
			static int n=BOT_START;
			::MoveWindow( m_hWnd, 0, n++ , m_nWidth, m_nHeight, FALSE);
			if( n == TOP_START )
			{
				KillTimer(2);
				n=BOT_START;
				bCurrentIsShow = false;
			}
			break;
		}
	case 3:
		HideWindowEx();
		KillTimer(3);
		bCurrentIsShow = false;
		break;
	}

	CButton::OnTimer(nIDEvent);
}

void CHPMessageBox::ShowWindowEx()
{
	if(bCurrentIsShow)
		return;

	SetTimer(1,NDELAY,NULL);
	SetTimer(3,5000,NULL);
}

void CHPMessageBox::HideWindowEx()
{
	if(!bCurrentIsShow)
		return;
	
	SetTimer(2,NDELAY,NULL);
}

⌨️ 快捷键说明

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