dlgchart.cpp

来自「是用c++实现的几个数字信号处理中的典型算法」· C++ 代码 · 共 100 行

CPP
100
字号
// DlgChart.cpp : 实现文件
//

#include "stdafx.h"
#include "InterVolve.h"
#include "DlgChart.h"
#include ".\dlgchart.h"


// CDlgChart 对话框

IMPLEMENT_DYNAMIC(CDlgChart, CDialog)
CDlgChart::CDlgChart(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgChart::IDD, pParent)
{
}

CDlgChart::~CDlgChart()
{
}

void CDlgChart::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(CDlgChart, CDialog)
	ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
END_MESSAGE_MAP()


// CDlgChart 消息处理程序

void CDlgChart::OnCancel()
{
	// TODO: 在此添加专用代码和/或调用基类

	//CDialog::OnCancel();
}

void CDlgChart::OnOK()
{
	// TODO: 在此添加专用代码和/或调用基类

	//CDialog::OnOK();
}

BOOL CDlgChart::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  在此添加额外的初始化

	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);

	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}

void CDlgChart::DrawChart()
{
	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();
}

void CDlgChart::OnBnClickedButton1()
{
	// TODO: 在此添加控件通知处理程序代码
	this->DrawChart();
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?