📄 newedit.cpp
字号:
// NewEdit.cpp : implementation file
//
#include "stdafx.h"
#include "calculator.h"
#include "NewEdit.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CNewEdit
CNewEdit::CNewEdit()
{
m_brush.CreateStockObject(HOLLOW_BRUSH);
}
CNewEdit::~CNewEdit()
{
}
BEGIN_MESSAGE_MAP(CNewEdit, CEdit)
//{{AFX_MSG_MAP(CNewEdit)
ON_WM_CTLCOLOR_REFLECT()
ON_CONTROL_REFLECT(EN_CHANGE, OnChange)
ON_WM_LBUTTONUP()
ON_WM_ERASEBKGND()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CNewEdit message handlers
HBRUSH CNewEdit::CtlColor(CDC* pDC, UINT nCtlColor)
{
// TODO: Change any attributes of the DC here
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(0xff,0xff,0xff));
return m_brush;
}
void CNewEdit::OnChange()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CEdit::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
Invalidate();
CRect rect,rect1,rect2;
GetClientRect(&rect1);
rect2=rect1;
MapWindowPoints(GetParent(),&rect1);
rect.left=rect1.left-rect2.left;
rect.right=rect1.right-rect2.right+rect1.Width ();
rect.top=rect1.top-rect2.top;
rect.bottom =rect1.bottom -rect2.bottom +rect1.Height ();
GetParent()->InvalidateRect(&rect,true);
}
void CNewEdit::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
Invalidate();
CEdit::OnLButtonUp(nFlags, point);
}
BOOL CNewEdit::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
return CEdit::OnEraseBkgnd(pDC);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -