messageview.cpp

来自「利用CSocket类编写的一个网络聊天程序,加深对CSocket类的基本应用的认」· C++ 代码 · 共 78 行

CPP
78
字号
// MessageView.cpp : implementation file
//

#include "stdafx.h"
#include "ChatClient.h"
#include "MessageView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMessageView

IMPLEMENT_DYNCREATE(CMessageView, CEditView)

CMessageView::CMessageView()
{
}

CMessageView::~CMessageView()
{
}


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

/////////////////////////////////////////////////////////////////////////////
// CMessageView drawing

void CMessageView::OnDraw(CDC* pDC)
{
	CDocument* pDoc = GetDocument();
	// TODO: add draw code here
}

/////////////////////////////////////////////////////////////////////////////
// CMessageView diagnostics

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

void CMessageView::Dump(CDumpContext& dc) const
{
	CEditView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMessageView message handlers
BOOL CMessageView::PreCreateWindow(CREATESTRUCT& cs) 
{
	BOOL ret = CEditView::PreCreateWindow(cs);
	cs.style = AFX_WS_DEFAULT_VIEW | 
		       WS_VSCROLL | 
		       ES_AUTOVSCROLL | 
			   ES_MULTILINE | 
			   ES_NOHIDESEL;
	return ret;
}

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

⌨️ 快捷键说明

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