⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dlgchart.cpp

📁 此 InterVolve 应用程序不仅介绍了使用 Microsoft 基础类的基本知识
💻 CPP
字号:
// 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -