📄 ptchannelview.cpp
字号:
// PTChannelView.cpp : implementation of the CPTChannelView class
//
#include "stdafx.h"
#include "PTChannel.h"
#include "PTChannelDoc.h"
#include "PTChannelView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPTChannelView
IMPLEMENT_DYNCREATE(CPTChannelView, CRichEditView)
BEGIN_MESSAGE_MAP(CPTChannelView, CRichEditView)
//{{AFX_MSG_MAP(CPTChannelView)
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPTChannelView construction/destruction
CPTChannelView::CPTChannelView()
{
// TODO: add construction code here
}
CPTChannelView::~CPTChannelView()
{
}
BOOL CPTChannelView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
BOOL bPreCreated = CRichEditView::PreCreateWindow(cs);
cs.style &= ~(ES_AUTOHSCROLL|WS_HSCROLL); // Enable word-wrapping
return bPreCreated;
}
/////////////////////////////////////////////////////////////////////////////
// CPTChannelView drawing
void CPTChannelView::OnDraw(CDC* pDC)
{
CPTChannelDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CPTChannelView diagnostics
#ifdef _DEBUG
void CPTChannelView::AssertValid() const
{
CRichEditView::AssertValid();
}
void CPTChannelView::Dump(CDumpContext& dc) const
{
CRichEditView::Dump(dc);
}
CPTChannelDoc* CPTChannelView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CPTChannelDoc)));
return (CPTChannelDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CPTChannelView message handlers
int CPTChannelView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CRichEditView::OnCreate(lpCreateStruct) == -1)
return -1;
//设置字体
m_EditFont.CreateFont(12,0, 0, 0,
FW_NORMAL,
0, 0, 0, 0,
0, 0, 0, 0,
"宋体");
this->GetRichEditCtrl().SetFont(&m_EditFont);
//设为只读模式
this->GetRichEditCtrl().SetReadOnly();
//设置背景色
//COLOR_WINDOWFRAME 黑色背景,框架色
//COLOR_SCROLLBAR 灰色背景,
COLORREF syscolor=::GetSysColor(COLOR_SCROLLBAR);//获得系统的相关颜色
this->GetRichEditCtrl().SetBackgroundColor(FALSE,syscolor);
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -