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

📄 mytext.cpp

📁 计算器源代码
💻 CPP
字号:
// MyText.cpp : implementation file
//

#include "stdafx.h"
#include "计算器.h"
#include "MyText.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMyText

CMyText::CMyText()
{
}

CMyText::~CMyText()
{
}


BEGIN_MESSAGE_MAP(CMyText, CStatic)
	//{{AFX_MSG_MAP(CMyText)
	ON_WM_PAINT()
	ON_WM_LBUTTONDOWN()
	ON_WM_MOUSEMOVE()
	ON_WM_SETCURSOR()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMyText message handlers


void CMyText::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
	dc.SetBkMode(TRANSPARENT);
	dc.TextOut(0,0,"一个模仿Windows计算器的小程序,");
	dc.TextOut(0,25,"本程序不用作任何商业用途");
	dc.TextOut(0,50,"本产品拥有权属于");
	dc.SetTextColor(0xff0000);
	dc.TextOut(125,50,"“风雪工作组”");
	dc.SetTextColor(0);
	dc.TextOut(55,80,"版权所有,违者必究");
	// Do not call CStatic::OnPaint() for painting messages
}

void CMyText::OnLButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	if(point.x>=125 && point.x<=230 && point.y>=50 && point.y<=65)
	{
		char IE[]="C:\\Program Files\\Internet Explorer\\Iexplore.exe";
		char WinDir[128];
		GetWindowsDirectory(WinDir,128);
		IE[0]=WinDir[0];
		ShellExecute(this->m_hWnd,"Open",IE,"http://www.fxstudio.xiloo.com/",NULL,SW_SHOW);
	}
	CStatic::OnLButtonDown(nFlags, point);
}

void CMyText::OnMouseMove(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	CClientDC pDC(this);
	pDC.SetBkMode(TRANSPARENT);
	if(point.x>=125 && point.x<=230 && point.y>=50 && point.y<=65)
	{
		pDC.SetTextColor(0x00ff00);
		m_hCursor=AfxGetApp()->LoadCursor(IDC_HAND);
	}
	else
	{
		pDC.SetTextColor(0xff0000);
		m_hCursor=AfxGetApp()->LoadCursor(IDC_STANDARD);
	}
	pDC.TextOut(125,50,"“风雪工作组”");
	CStatic::OnMouseMove(nFlags, point);
}

BOOL CMyText::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) 
{
	// TODO: Add your message handler code here and/or call default
	::SetCursor(m_hCursor);
	return TRUE;
	//return CStatic::OnSetCursor(pWnd,nHitTest,message);
}

⌨️ 快捷键说明

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