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

📄 piddlg.cpp

📁 这是一个水箱的液位控制程序
💻 CPP
字号:
// 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -