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

📄 messageedit.cpp

📁 嵌入式DOS系统上位升级程序FileUpgrade, 需配合本人上传的FileUpr程序应用, VC++开发, 非常实用, 内附说明及源码
💻 CPP
字号:
// MessageEdit.cpp : implementation file
//

#include "stdafx.h"
#include "MessageEdit.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMessageEdit

CMessageEdit::CMessageEdit()
{
}

CMessageEdit::~CMessageEdit()
{
}


BEGIN_MESSAGE_MAP(CMessageEdit, CEdit)
	//{{AFX_MSG_MAP(CMessageEdit)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMessageEdit message handlers
void CMessageEdit::SubclassDlgItem(UINT nID, CWnd *pParent,int MaxLine/*=300*/)
{
	#define SPECIAL_STYLE (ES_MULTILINE|ES_AUTOVSCROLL|ES_WANTRETURN|WS_VSCROLL)
	m_MaxLineCount=MaxLine;	
	CEdit::SubclassDlgItem(nID, pParent);
	if((GetStyle()&SPECIAL_STYLE)!=SPECIAL_STYLE)
	{
		MessageBox("信息编辑框设置不正确,可能无法工作,重新编译");		
	};
}
void CMessageEdit::ClearText()
{
	SetWindowText("");
}
void CMessageEdit::AddText(const char *text)
{
	if(GetLineCount()>m_MaxLineCount)
	{
		SetSel(0,LineIndex(m_MaxLineCount/3),1);
		Clear();			
	}
	int x=GetWindowTextLength();
	SetSel(x,x,0);
	ReplaceSel(text);
}
void CMessageEdit::AddText(const CString &text)
{
	if(GetLineCount()>m_MaxLineCount)
	{
		SetSel(0,LineIndex(m_MaxLineCount/3),1);
		Clear();			
	}
	int x=GetWindowTextLength();
	SetSel(x,x,0);
	ReplaceSel(text);
}
void CMessageEdit::EditPrintf(char *szFormat, ...)
{
	char   szBuffer [1024];
	va_list pArgList;
	va_start (pArgList, szFormat);  
	vsprintf (szBuffer, szFormat, pArgList); 
	va_end (pArgList);
	SetSel(0xFFFF,0xFFFF,0);
	ReplaceSel(szBuffer);
}

⌨️ 快捷键说明

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