piddlg.cpp

来自「这是一个水箱的液位控制程序」· C++ 代码 · 共 102 行

CPP
102
字号
// PIDDlg.cpp : implementation file//#include "stdafx.h"#include "水箱实验.h"#include "PIDDlg.h"#include "conio.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif/////////////////////////////////////////////////////////////////////////////// CPIDDlg dialogCPIDDlg::CPIDDlg(CWnd* pParent /*=NULL*/)	: CDialog(CPIDDlg::IDD, pParent){	//{{AFX_DATA_INIT(CPIDDlg)	m_pidtd1 = 0.0;	m_pidkp1 = 0.0;	m_pidkp2 = 0.0;	m_pidtd2 = 0.0;	m_pidti1 = 0.0;	m_pidti2 = 0.0;	//}}AFX_DATA_INIT}void CPIDDlg::DoDataExchange(CDataExchange* pDX){	CDialog::DoDataExchange(pDX);	//{{AFX_DATA_MAP(CPIDDlg)	DDX_Text(pDX, IDC_PIDTD1, m_pidtd1);	DDX_Text(pDX, IDC_PIDKP1, m_pidkp1);	DDX_Text(pDX, IDC_PIDKP2, m_pidkp2);	DDX_Text(pDX, IDC_PIDTD2, m_pidtd2);	DDX_Text(pDX, IDC_PIDTI1, m_pidti1);	DDX_Text(pDX, IDC_PIDTI2, m_pidti2);	//}}AFX_DATA_MAP}BEGIN_MESSAGE_MAP(CPIDDlg, CDialog)	//{{AFX_MSG_MAP(CPIDDlg)	ON_WM_PAINT()	//}}AFX_MSG_MAPEND_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////// CPIDDlg message handlersvoid CPIDDlg::OnPaint() {	CPaintDC dc(this); // device context for painting		// TODO: Add your message handler code here	CString		str;	str.Format("%f",m_pidkp1);	SetDlgItemText(IDC_PIDKP1,str);	str.Format("%f",m_pidti1);	SetDlgItemText(IDC_PIDTI1,str);	str.Format("%f",m_pidtd1);	SetDlgItemText(IDC_PIDTD1,str);		str.Format("%f",m_pidkp2);	SetDlgItemText(IDC_PIDKP2,str);	str.Format("%f",m_pidti2);	SetDlgItemText(IDC_PIDTI2,str);	str.Format("%f",m_pidtd2);	SetDlgItemText(IDC_PIDTD2,str);		HWND edit;	GetDlgItem(IDC_PIDKP1,&edit);	::SetFocus(edit);	// Do not call CDialog::OnPaint() for painting messages}void CPIDDlg::OnOK() {	// TODO: Add extra validation here	CString str;	GetDlgItemText(IDC_PIDKP1,str);	m_pidkp1 = strtod(LPCTSTR(str),NULL);	GetDlgItemText(IDC_PIDTI1,str);	m_pidti1 = strtod(LPCTSTR(str),NULL);	GetDlgItemText(IDC_PIDTD1,str);	m_pidtd1 = strtod(LPCTSTR(str),NULL);	GetDlgItemText(IDC_PIDKP2,str);	m_pidkp2 = strtod(LPCTSTR(str),NULL);	GetDlgItemText(IDC_PIDTI2,str);	m_pidti2 = strtod(LPCTSTR(str),NULL);	GetDlgItemText(IDC_PIDTD2,str);	m_pidtd2 = strtod(LPCTSTR(str),NULL);		CDialog::OnOK();}

⌨️ 快捷键说明

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