chatterview.cpp

来自「《Visual C++.NET MFC类库应用详解》程序实例」· C++ 代码 · 共 75 行

CPP
75
字号
// ChatterView.cpp : CChatterView 类的实现
//

#include "stdafx.h"
#include "Chatter.h"

#include "ChatterDoc.h"
#include "ChatterView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CChatterView

IMPLEMENT_DYNCREATE(CChatterView, CEditView)

BEGIN_MESSAGE_MAP(CChatterView, CEditView)
END_MESSAGE_MAP()

// CChatterView 构造/销毁

CChatterView::CChatterView()
{
	// TODO: 在此处添加构造代码

}

CChatterView::~CChatterView()
{
}

BOOL CChatterView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: 在此处通过修改 CREATESTRUCT cs 来修改窗口类或
	// 样式
	BOOL ret = CEditView::PreCreateWindow(cs);
	cs.style = AFX_WS_DEFAULT_VIEW | WS_VSCROLL | ES_AUTOHSCROLL |
		ES_AUTOVSCROLL | ES_MULTILINE | ES_NOHIDESEL | ES_READONLY;
	return ret;
}

void CChatterView::Message(LPCTSTR lpszMessage)
{
	CString strTemp = lpszMessage;
	strTemp += _T("\r\n");
	int len = GetWindowTextLength();
	GetEditCtrl().SetSel(len,len);
	GetEditCtrl().ReplaceSel(strTemp);
}

// CChatterView 诊断

#ifdef _DEBUG
void CChatterView::AssertValid() const
{
	CEditView::AssertValid();
}

void CChatterView::Dump(CDumpContext& dc) const
{
	CEditView::Dump(dc);
}

CChatterDoc* CChatterView::GetDocument() const // 非调试版本是内联的
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CChatterDoc)));
	return (CChatterDoc*)m_pDocument;
}
#endif //_DEBUG


// CChatterView 消息处理程序

⌨️ 快捷键说明

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