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

📄 chatview.cpp

📁 利用CSocket类编写的一个网络聊天程序,加深对CSocket类的基本应用的认识.
💻 CPP
字号:
// ChatView.cpp : implementation file
//

#include "stdafx.h"
#include "ChatServer.h"
#include "ChatView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CChatView

IMPLEMENT_DYNCREATE(CChatView, CView)

CChatView::CChatView()
{
}

CChatView::~CChatView()
{
}


BEGIN_MESSAGE_MAP(CChatView, CView)
	//{{AFX_MSG_MAP(CChatView)
	ON_WM_CREATE()
	ON_WM_SIZE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CChatView drawing

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

/////////////////////////////////////////////////////////////////////////////
// CChatView diagnostics

#ifdef _DEBUG
void CChatView::AssertValid() const
{
	CView::AssertValid();
}

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

/////////////////////////////////////////////////////////////////////////////
// CChatView message handlers

int CChatView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CView::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// TODO: Add your specialized creation code here
	CRect rect;
	GetClientRect(&rect);
	m_EditBox.Create(WS_VISIBLE |
		             WS_BORDER |
					 WS_CHILD |
					 ES_MULTILINE |
					 WS_VSCROLL,
					 rect, this , 0);
	return 0;
}

void CChatView::OnSize(UINT nType, int cx, int cy) 
{
	CView::OnSize(nType, cx, cy);
	
	// TODO: Add your message handler code here
	m_EditBox.MoveWindow(0 , 0 , cx , cy , FALSE);
}

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

⌨️ 快捷键说明

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