📄 display.cpp
字号:
// Display.cpp : implementation file
//
#include "stdafx.h"
#include "StickSlip.h"
#include "Display.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDisplay
CDisplay::CDisplay()
{
m_comment = "";//测量数据";
//cxGraph = 3800;
//cyGraph = 550;
// TODO: Add your specialized code here and/or call the base class
}
CDisplay::~CDisplay()
{
}
BEGIN_MESSAGE_MAP(CDisplay, CStatic)
//{{AFX_MSG_MAP(CDisplay)
ON_WM_ERASEBKGND()
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDisplay message handlers
BOOL CDisplay::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
CBrush backBrush(m_BackGroundColor);
// Save the old brush
CBrush* pOldBrush = pDC->SelectObject(&backBrush);
// Get the current clipping boundary
CRect rect;
GetClientRect(rect);
// Erase the area needed
pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(),
PATCOPY);
pDC->SelectObject(pOldBrush); // Select the old brush back
return TRUE; // message handled
// return CStatic::OnEraseBkgnd(pDC);
}
void CDisplay::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
DrawComment();
// Do not call CStatic::OnPaint() for painting messages
}
void CDisplay::Create(CRect Pos, CWnd *pParentWnd)
{
int Ret = CStatic::Create(_T("zxs"),WS_CHILD | WS_VISIBLE | SS_GRAYFRAME | WS_BORDER,
Pos,pParentWnd);
}
void CDisplay::SetComment(CString &strcomment)
{
m_comment = strcomment;
// TODO: Add your specialized code here.
}
void CDisplay::SetData(CPoint *pdate, int N)
{
// TODO: Add your specialized code here.
}
void CDisplay::DrawComment()
{
CClientDC dc(this);
CRect ClientRect;
GetClientRect(ClientRect);
//dc.SetBkColor(RGB(150,150,20));
dc.SetBkMode(TRANSPARENT);
CRect TxtRect(ClientRect.Width()/2 - 50,0,ClientRect.Width()/2 + 50 , 20);
dc.DrawText(m_comment, &TxtRect, DT_CENTER | DT_WORDBREAK);
// TODO: Add your specialized code here.
}
void CDisplay::SetOrgAndExt(CDC *pDC)
{
// TODO: Add your specialized code here.
}
void CDisplay::set_BackGroundColor(COLORREF value)
{
// TODO: Add your specialized code here.
m_BackGroundColor = value;
return;
}
void CDisplay::DrawData(CDC *pDC)
{
// TODO: Add your specialized code here.
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -