📄 ssview.cpp
字号:
// SSView.cpp : implementation of the CSSView class
//
#include "stdafx.h"
#include "SS.h"
#include "SSDoc.h"
#include "SSView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSSView
IMPLEMENT_DYNCREATE(CSSView, CEditView)
BEGIN_MESSAGE_MAP(CSSView, CEditView)
//{{AFX_MSG_MAP(CSSView)
ON_WM_CTLCOLOR_REFLECT()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CEditView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CEditView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CEditView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSSView construction/destruction
CSSView::CSSView()
{
this->m_crBackColor=RGB(255,255,255);
this->m_crTextColor=RGB(0,0,255);
}
CSSView::~CSSView()
{
}
BOOL CSSView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
BOOL bPreCreated = CEditView::PreCreateWindow(cs);
cs.style &= ~(ES_AUTOHSCROLL|WS_HSCROLL); // Enable word-wrapping
return bPreCreated;
}
/////////////////////////////////////////////////////////////////////////////
// CSSView drawing
void CSSView::OnDraw(CDC* pDC)
{
CSSDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CSSView printing
BOOL CSSView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default CEditView preparation
return CEditView::OnPreparePrinting(pInfo);
}
void CSSView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
{
// Default CEditView begin printing.
CEditView::OnBeginPrinting(pDC, pInfo);
}
void CSSView::OnEndPrinting(CDC* pDC, CPrintInfo* pInfo)
{
// Default CEditView end printing
CEditView::OnEndPrinting(pDC, pInfo);
}
/////////////////////////////////////////////////////////////////////////////
// CSSView diagnostics
#ifdef _DEBUG
void CSSView::AssertValid() const
{
CEditView::AssertValid();
}
void CSSView::Dump(CDumpContext& dc) const
{
CEditView::Dump(dc);
}
CSSDoc* CSSView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CSSDoc)));
return (CSSDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CSSView message handlers
HBRUSH CSSView::CtlColor(CDC* pDC, UINT nCtlColor)
{
if(nCtlColor == CTLCOLOR_EDIT )
{
pDC->SetTextColor(m_crTextColor); //设置字体颜色
pDC->SetBkColor(m_crBackColor);
return (HBRUSH)CreateSolidBrush(m_crBackColor); //设置背景颜色
}
}
void CSSView::OnInitialUpdate()
{
CEditView::OnInitialUpdate();
}
void CSSView::SetTextColor(COLORREF crTextColor)
{
this->m_crTextColor=crTextColor;
this->GetEditCtrl().Invalidate();
}
void CSSView::SetBackColor(COLORREF crBackColor)
{
this->m_crBackColor=crBackColor;
this->GetEditCtrl().Invalidate();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -