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

📄 rptoptdlg.cpp

📁 一个通过USB->UART读取C8051F060的程序
💻 CPP
字号:
// RptOptDlg.cpp : implementation file
//

#include "stdafx.h"
#include "BattTest.h"
#include "RptOptDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CRptOptDlg dialog


CRptOptDlg::CRptOptDlg(ReportVisInfo *pReportVisInfo, CWnd* pParent /*=NULL*/)
	: CDialog(CRptOptDlg::IDD, pParent), m_pReportVisInfo(pReportVisInfo)
{
	//{{AFX_DATA_INIT(CRptOptDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CRptOptDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CRptOptDlg)
	DDX_Control(pDX, IDC_BATTTYPE_EDIT, m_wndBattType);
	DDX_Control(pDX, IDC_STEPTIME_EDIT, m_wndTime);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CRptOptDlg, CDialog)
	//{{AFX_MSG_MAP(CRptOptDlg)
	ON_BN_CLICKED(IDC_COMMIT_BTN, OnCommit)
	ON_BN_CLICKED(IDC_CANCEL_BTN, OnCancel)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CRptOptDlg message handlers
void CRptOptDlg::OnCommit() 
{
		//汇集参数
		if (m_pReportVisInfo != NULL)
		{
				CButton  *pBtn = (CButton *)GetDlgItem(IDC_PRINTCURVE_CK);
				m_pReportVisInfo->bPlotVis = pBtn->GetCheck();
				
				pBtn = (CButton *)GetDlgItem(IDC_PRINTFEATURE_CK);
				m_pReportVisInfo->bFeatureVis   = pBtn->GetCheck();
				
				pBtn = (CButton *)GetDlgItem(IDC_PRINTVOLTAGE_CK);
				m_pReportVisInfo->bDataTableVis = pBtn->GetCheck();
				
				////////////////////////////////////////////////////////////
				CString  strCtx;
				m_wndTime.GetWindowText(strCtx);
				m_pReportVisInfo->sElapse       = ::atof(strCtx);
				
				//电池型号
				m_wndBattType.GetWindowText(strCtx);
				::memcpy(m_pReportVisInfo->szFmt, strCtx.GetBuffer(0), strCtx.GetLength()>=64?64:strCtx.GetLength());
				::AfxGetApp()->WriteProfileString("配置", "电池型号", (LPCTSTR)strCtx);
		}

		//
		this->EndDialog(1);
}

BOOL CRptOptDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	//
	CButton  *pBtn = (CButton *)GetDlgItem(IDC_PRINTCURVE_CK);
	pBtn->SetCheck(TRUE);
	pBtn = (CButton *)GetDlgItem(IDC_PRINTFEATURE_CK);
	pBtn->SetCheck(TRUE);
	pBtn = (CButton *)GetDlgItem(IDC_PRINTVOLTAGE_CK);
	pBtn->SetCheck(TRUE);
	
	//
	m_wndTime.SetRange(1.0f, 600.0f);
	m_wndTime.SetWindowText("10");

	//
	CString   strBattType;
	strBattType = ::AfxGetApp()->GetProfileString("配置", "电池型号", NULL);
	m_wndBattType.SetWindowText((LPCTSTR)strBattType);
	
	//
	

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CRptOptDlg::OnCancel() 
{
	this->EndDialog(2);	
}

⌨️ 快捷键说明

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