?? chatvw.cpp
字號:
// chatvw.cpp : implementation of the CChatView class
//
// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (C) 1992-1997 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.
#include "stdafx.h"
#include "chatter.h"
#include "chatdoc.h"
#include "chatvw.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CChatView
IMPLEMENT_DYNCREATE(CChatView, CRichEditView)
BEGIN_MESSAGE_MAP(CChatView, CRichEditView)
//{{AFX_MSG_MAP(CChatView)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CChatView construction/destruction
CChatView::CChatView()
{
}
CChatView::~CChatView()
{
}
/////////////////////////////////////////////////////////////////////////////
// CChatView drawing
void CChatView::OnDraw(CDC* pDC)
{
CChatDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
}
/////////////////////////////////////////////////////////////////////////////
// CChatView diagnostics
#ifdef _DEBUG
void CChatView::AssertValid() const
{
CRichEditView::AssertValid();
}
void CChatView::Dump(CDumpContext& dc) const
{
CRichEditView::Dump(dc);
}
CChatDoc* CChatView::GetDocument() // non-debug version is inline
{
return STATIC_DOWNCAST(CChatDoc, m_pDocument);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CChatView message handlers
BOOL CChatView::PreCreateWindow(CREATESTRUCT& cs)
{
BOOL ret = CRichEditView::PreCreateWindow(cs);
cs.style = AFX_WS_DEFAULT_VIEW | WS_VSCROLL | ES_AUTOHSCROLL |
ES_AUTOVSCROLL | ES_MULTILINE | ES_NOHIDESEL | ES_READONLY;
return ret;
}
void CChatView::Message(LPCTSTR lpszMessage,COLORREF clr)
{
if(!GetDocument()->allowshow) return;
cfm.cbSize=sizeof(cfm);
cfm.crTextColor=clr;
cfm.dwMask=CFM_COLOR;
CString strTemp = lpszMessage;
int len = GetWindowTextLength();
GetRichEditCtrl().SetSel(len,len);
GetRichEditCtrl().SetSelectionCharFormat(cfm);
GetRichEditCtrl().ReplaceSel(strTemp);
//UnlockWindowUpdate();
}
void CChatView::OnInitialUpdate()
{
CRichEditView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
cfm.cbSize=sizeof(cfm);
cfm.bCharSet=GB2312_CHARSET;
cfm.crTextColor=RGB(0,0,0);
cfm.dwMask=CFM_CHARSET | CFM_COLOR ;
GetRichEditCtrl().SetDefaultCharFormat(cfm);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -