📄 textview.cpp
字号:
// TextView.cpp : implementation of the CTextView class
//
#include "stdafx.h"
#include "MThread.h"
#include "TextView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CTextView
CTextView::CTextView()
{
m_ColorText=RGB(0,0,0);
}
CTextView::~CTextView()
{
}
BEGIN_MESSAGE_MAP(CTextView,CWnd )
ON_WM_PAINT()
ON_COMMAND(ID_VIEW_COLOR, OnViewColor)
END_MESSAGE_MAP()
// CTextView message handlers
BOOL CTextView::PreCreateWindow(CREATESTRUCT& cs)
{
if (!CWnd::PreCreateWindow(cs))
return FALSE;
cs.dwExStyle |= WS_EX_CLIENTEDGE;
cs.style &= ~WS_BORDER;
cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS,
::LoadCursor(NULL, IDC_ARROW), HBRUSH(COLOR_WINDOW+1), NULL);
return TRUE;
}
void CTextView::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
CRect rect;
dc.SetTextColor(m_ColorText);
dc.SetBkColor(::GetSysColor(COLOR_WINDOW));
GetClientRect(rect);
dc.DrawText(_T("Hello, World!"),-1,rect,DT_SINGLELINE|DT_CENTER|DT_VCENTER);
// Do not call CWnd::OnPaint() for painting messages
}
void CTextView::OnViewColor()
{
// TODO: Add your command handler code here
CColorDialog dlgColor(m_ColorText);
if(dlgColor.DoModal()==IDOK)
{
m_ColorText=dlgColor.GetColor();
Invalidate();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -