📄 relay.cpp
字号:
// relay.cpp : implementation file
//
#include "stdafx.h"
#include "dxmanger.h"
#include "relay.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// relay dialog
relay::relay(CWnd* pParent /*=NULL*/)
: CDialog(relay::IDD, pParent)
{
//{{AFX_DATA_INIT(relay)
m_needrelay = FALSE;
m_relaynumber = 8;
m_relay8 = _T("000008");
m_relay7 = _T("000007");
m_relay6 = _T("000006");
m_relay5 = _T("000005");
m_relay4 = _T("000004");
m_relay3 = _T("000003");
m_relay2 = _T("000002");
m_relay1 = _T("000001");
//}}AFX_DATA_INIT
}
void relay::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(relay)
DDX_Text(pDX, IDC_RELAY1, m_relay1);
DDV_MaxChars(pDX, m_relay1, 6);
DDX_Text(pDX, IDC_RELAY2, m_relay2);
DDV_MaxChars(pDX, m_relay2, 6);
DDX_Text(pDX, IDC_RELAY3, m_relay3);
DDV_MaxChars(pDX, m_relay3, 6);
DDX_Text(pDX, IDC_RELAY4, m_relay4);
DDV_MaxChars(pDX, m_relay4, 6);
DDX_Text(pDX, IDC_RELAY5, m_relay5);
DDV_MaxChars(pDX, m_relay5, 6);
DDX_Text(pDX, IDC_RELAY6, m_relay6);
DDV_MaxChars(pDX, m_relay6, 6);
DDX_Text(pDX, IDC_RELAY7, m_relay7);
DDV_MaxChars(pDX, m_relay7, 6);
DDX_Text(pDX, IDC_RELAY8, m_relay8);
DDV_MaxChars(pDX, m_relay8, 6);
DDX_Check(pDX, IDC_NEEDRELAY, m_needrelay);
DDX_Text(pDX, IDC_RELAYNUMBER, m_relaynumber);
DDV_MinMaxUInt(pDX, m_relaynumber, 0, 8);
GetDlgItem( IDC_RELAYNUMBER )->EnableWindow(FALSE);
GetDlgItem( IDC_RELAY1 )->EnableWindow(FALSE);
GetDlgItem( IDC_RELAY2 )->EnableWindow(FALSE);
GetDlgItem( IDC_RELAY3 )->EnableWindow(FALSE);
GetDlgItem( IDC_RELAY4 )->EnableWindow(FALSE);
GetDlgItem( IDC_RELAY5 )->EnableWindow(FALSE);
GetDlgItem( IDC_RELAY6 )->EnableWindow(FALSE);
GetDlgItem( IDC_RELAY7 )->EnableWindow(FALSE);
GetDlgItem( IDC_RELAY8 )->EnableWindow(FALSE);
if(m_needrelay)
{
GetDlgItem( IDC_RELAYNUMBER )->EnableWindow(TRUE);
GetDlgItem( IDC_RELAY1 )->EnableWindow(TRUE);
GetDlgItem( IDC_RELAY2 )->EnableWindow(TRUE);
GetDlgItem( IDC_RELAY3 )->EnableWindow(TRUE);
GetDlgItem( IDC_RELAY4 )->EnableWindow(TRUE);
GetDlgItem( IDC_RELAY5 )->EnableWindow(TRUE);
GetDlgItem( IDC_RELAY6 )->EnableWindow(TRUE);
GetDlgItem( IDC_RELAY7 )->EnableWindow(TRUE);
GetDlgItem( IDC_RELAY8 )->EnableWindow(TRUE);
}
SetWindowText("中继设置 ");
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(relay, CDialog)
//{{AFX_MSG_MAP(relay)
ON_BN_CLICKED(IDC_NEEDRELAY, OnNeedrelay)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// relay message handlers
void relay::OnNeedrelay()
{
// TODO: Add your control notification handler code here
// GetDlgItem( IDC_RELAYNUMBER )->EnableWindow(FALSE);
UpdateData(TRUE);
if(m_needrelay)
{
//AfxMessageBox("d");
GetDlgItem( IDC_RELAYNUMBER )->EnableWindow(TRUE);
GetDlgItem( IDC_RELAY1 )->EnableWindow(TRUE);
GetDlgItem( IDC_RELAY2 )->EnableWindow(TRUE);
GetDlgItem( IDC_RELAY3 )->EnableWindow(TRUE);
GetDlgItem( IDC_RELAY4 )->EnableWindow(TRUE);
GetDlgItem( IDC_RELAY5 )->EnableWindow(TRUE);
GetDlgItem( IDC_RELAY6 )->EnableWindow(TRUE);
GetDlgItem( IDC_RELAY7 )->EnableWindow(TRUE);
GetDlgItem( IDC_RELAY8 )->EnableWindow(TRUE);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -