📄 tsqsyview.cpp
字号:
// TsqSyView.cpp : implementation file
//
#include "stdafx.h"
#include "Tsq.h"
#include "TsqSyView.h"
#include "TsqDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTsqSyView
IMPLEMENT_DYNCREATE(CTsqSyView, CFormView)
CTsqSyView::CTsqSyView()
: CFormView(CTsqSyView::IDD)
{
//{{AFX_DATA_INIT(CTsqSyView)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
CTsqSyView::~CTsqSyView()
{
}
void CTsqSyView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTsqSyView)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CTsqSyView, CFormView)
//{{AFX_MSG_MAP(CTsqSyView)
ON_BN_CLICKED(IDC_BT_ZCD, OnBtZcd)
ON_WM_CREATE()
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTsqSyView diagnostics
#ifdef _DEBUG
void CTsqSyView::AssertValid() const
{
CFormView::AssertValid();
}
void CTsqSyView::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CTsqSyView message handlers
BOOL CTsqSyView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Add your specialized code here and/or call the base class
cs.style=WS_CHILD;
return CFormView::PreCreateWindow(cs);
}
void CTsqSyView::OnDraw(CDC* pDC)
{
// TODO: Add your specialized code here and/or call the base class
}
void CTsqSyView::OnBtZcd()
{
CWnd*p=GetParent();
p->PostMessage(WM_COMMAND,MAKEWPARAM(ID_ZCD,0),0L);
}
void CTsqSyView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
m_wndLineChart.SubclassDlgItem(IDC_LINE_CHART_CTRL, this);
m_wndLineChart.Add(RGB(0,255,0),100, 0);
m_wndLineChart.Add(RGB(255,255,0),100, 0);
m_wndLineChart.Add(RGB(0,255,255),100, 0);
m_ZcdBt.SubclassDlgItem( IDC_BT_ZCD, this );
m_ZcdBt.SetTxetBk(RGB(0,0,0));
}
int CTsqSyView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFormView::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
SetTimer(1, 500, NULL);
return 0;
}
void CTsqSyView::OnTimer(UINT nIDEvent)
{
CTime t = CTime::GetCurrentTime();
int nRandom;
srand(t.GetSecond());
do
{
nRandom = rand();
} while (nRandom < 10 || nRandom > 25);
m_wndLineChart.SetPos(0,nRandom);
do
{
nRandom = rand();
} while (nRandom < 0 || nRandom > 100);
m_wndLineChart.SetPos(1,nRandom);
do
{
nRandom = rand();
} while (nRandom < 75 || nRandom > 95);
m_wndLineChart.SetPos(2,nRandom);
m_wndLineChart.Go();
CFormView::OnTimer(nIDEvent);
}
BOOL CTsqSyView::DestroyWindow()
{
// TODO: Add your specialized code here and/or call the base class
KillTimer(1);
return CFormView::DestroyWindow();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -