📄 tipview.cpp
字号:
// TipView.cpp : implementation file
//
#include "stdafx.h"
#include "AcquireKlg.h"
#include "TipView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTipView
IMPLEMENT_DYNCREATE(CTipView, CFormView)
CTipView::CTipView()
: CFormView(CTipView::IDD),m_bTipViewCreated(false)
{
//{{AFX_DATA_INIT(CTipView)
//}}AFX_DATA_INIT
}
CTipView::~CTipView()
{
}
void CTipView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTipView)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CTipView, CFormView)
//{{AFX_MSG_MAP(CTipView)
ON_WM_ERASEBKGND()
ON_WM_SIZE()
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTipView diagnostics
#ifdef _DEBUG
void CTipView::AssertValid() const
{
CFormView::AssertValid();
}
void CTipView::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CTipView message handlers
//将视图的背景改成与编辑框一样大
BOOL CTipView::OnEraseBkgnd(CDC* pDC)
{
CBrush newBrush(RGB(255,255,255));
CBrush *oldBrush = pDC->SelectObject(&newBrush);
CRect ClientRect;
pDC->GetClipBox(&ClientRect);
// pDC->PatBlt(ClientRect.left,ClientRect.top,ClientRect.right,ClientRect.bottom,PATCOPY);
//GetClientRect(&ClientRect);
pDC->PatBlt(ClientRect.left,ClientRect.top,ClientRect.right,ClientRect.bottom,PATCOPY);
pDC->SelectObject(oldBrush);
static int i =0;
TRACE("redraw the background %d " ,i++);
return TRUE;
//return CFormView::OnEraseBkgnd(pDC);
}
void CTipView::OnSize(UINT nType, int cx, int cy)
{
//保持编辑框大小始终与视图区大小相适应
if(m_bTipViewCreated==true)
m_cTipEdit.SetWindowPos(NULL,0,0,cx,cy,SWP_NOZORDER);
CFormView::OnSize(nType, cx, cy);
}
int CTipView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFormView::OnCreate(lpCreateStruct) == -1)
return -1;
//CRect rect;
// GetClientRect(&rect);
return 0;
}
void CTipView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
CRect rect;
GetClientRect(&rect);
m_cTipEdit.Create(WS_VSCROLL|ES_MULTILINE|WS_VISIBLE,rect,this,IDC_TIPEDIT);
//m_etTips.Create(WS_VISIBLE|WS_SIZEBOX,CRect(140,20,220,40),this,IDC_EDIT_OBJNAME);
m_bTipViewCreated = true;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -