📄 conwnddlg.cpp
字号:
// ConWndDlg.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "ConWndDlg.h"
#include "FLADS.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CConWndDlg dialog
extern CFLADSApp theApp;
CConWndDlg::CConWndDlg(CWnd* pParent /*=NULL*/)
: CDialog(CConWndDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CConWndDlg)
m_user_name = _T("");
//}}AFX_DATA_INIT
}
void CConWndDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CConWndDlg)
DDX_Control(pDX, IDC_FACE, m_face);
DDX_Control(pDX, IDC_R2HOTON, m_r2hoton);
DDX_Control(pDX, IDC_R2HOTOFF, m_r2hotoff);
DDX_Control(pDX, IDC_R1HOTON, m_r1hoton);
DDX_Control(pDX, IDC_R1HOTOFF, m_r1hotoff);
DDX_Control(pDX, IDC_QXON, m_qxon);
DDX_Control(pDX, IDC_QXOFF, m_qxoff);
DDX_Control(pDX, IDC_ZMON, m_zmon);
DDX_Control(pDX, IDC_ZMOFF, m_zmoff);
DDX_Control(pDX, IDC_XZON, m_xzon);
DDX_Control(pDX, IDC_XZOFF, m_xzoff);
DDX_Control(pDX, IDC_PWON, m_pwon);
DDX_Control(pDX, IDC_PWOFF, m_pwoff);
DDX_Control(pDX, IDC_WS2ON, m_ws2on);
DDX_Control(pDX, IDC_WS2OFF, m_ws2off);
DDX_Control(pDX, IDC_WS1ON, m_ws1on);
DDX_Control(pDX, IDC_WS1OFF, m_ws1off);
DDX_Control(pDX, IDC_SLHOTON, m_slhoton);
DDX_Control(pDX, IDC_SLHOTOFF, m_slhotoff);
DDX_Control(pDX, IDC_TRANSON, m_transon);
DDX_Control(pDX, IDC_TRANSOFF, m_transoff);
DDX_Control(pDX, IDC_ON, m_on);
DDX_Control(pDX, IDC_OFF, m_off);
DDX_Control(pDX, IDC_MANUL, m_manul);
DDX_Control(pDX, IDC_AUTO, m_auto);
DDX_Control(pDX, IDC_R3HOTOFF, m_r3hotoff);
DDX_Control(pDX, IDC_R3HOTON, m_r3hoton);
DDX_Control(pDX, IDC_STSINFO, m_stsinfo);
DDX_Control(pDX, IDC_WARNCODE, m_warncode);
DDX_Control(pDX, IDC_SCALE, m_scale);
DDX_Control(pDX, IDC_SLTSTS, m_slsts);
DDX_Text(pDX, IDC_EDIT6, m_user_name);
DDV_MaxChars(pDX, m_user_name, 20);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CConWndDlg, CDialog)
//{{AFX_MSG_MAP(CConWndDlg)
ON_WM_CTLCOLOR()
ON_WM_DESTROY()
ON_WM_TIMER()
ON_BN_CLICKED(IDC_AUTO, OnAuto)
ON_BN_CLICKED(IDC_MANUL, OnManul)
ON_BN_CLICKED(IDC_ON, OnOn)
ON_BN_CLICKED(IDC_OFF, OnOff)
ON_BN_CLICKED(IDC_R1HOTON, OnR1hoton)
ON_BN_CLICKED(IDC_R1HOTOFF, OnR1hotoff)
ON_BN_CLICKED(IDC_R2HOTON, OnR2hoton)
ON_BN_CLICKED(IDC_R2HOTOFF, OnR2hotoff)
ON_BN_CLICKED(IDC_R3HOTON, OnR3hoton)
ON_BN_CLICKED(IDC_R3HOTOFF, OnR3hotoff)
ON_BN_CLICKED(IDC_SLHOTON, OnSlhoton)
ON_BN_CLICKED(IDC_SLHOTOFF, OnSlhotoff)
ON_BN_CLICKED(IDC_WS1ON, OnWs1on)
ON_BN_CLICKED(IDC_WS1OFF, OnWs1off)
ON_BN_CLICKED(IDC_WS2ON, OnWs2on)
ON_BN_CLICKED(IDC_WS2OFF, OnWs2off)
ON_BN_CLICKED(IDC_TRANSON, OnTranson)
ON_BN_CLICKED(IDC_TRANSOFF, OnTransoff)
ON_BN_CLICKED(IDC_QXON, OnQxon)
ON_BN_CLICKED(IDC_QXOFF, OnQxoff)
ON_BN_CLICKED(IDC_XZON, OnXzon)
ON_BN_CLICKED(IDC_XZOFF, OnXzoff)
ON_BN_CLICKED(IDC_ZMON, OnZmon)
ON_BN_CLICKED(IDC_ZMOFF, OnZmoff)
ON_BN_CLICKED(IDC_PWON, OnPwon)
ON_BN_CLICKED(IDC_PWOFF, OnPwoff)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CConWndDlg message handlers
HBRUSH CConWndDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
// TODO: Return a different brush if the default is not desired
if(nCtlColor==CTLCOLOR_EDIT)
{
switch(theApp.temp_type)
{
case 0://二温区
if(pWnd->m_hWnd == ((CEdit *)GetDlgItem(IDC_R3HOTSV))->m_hWnd )
{
pDC->SetTextColor(RGB(212, 208, 200) );
pDC->SetBkColor(RGB(212, 208, 200) );
return hbrush;
}
if(pWnd->m_hWnd == ((CEdit *)GetDlgItem(IDC_R3HOTPV))->m_hWnd )
{
pDC->SetTextColor(RGB(212, 208, 200) );
pDC->SetBkColor(RGB(212, 208, 200) );
return hbrush;
}
break;
}
switch(theApp.wave_type)
{
case 0://高波
if(pWnd->m_hWnd == ((CEdit *)GetDlgItem(IDC_WS1SV))->m_hWnd )
{
pDC->SetTextColor(RGB(212, 208, 200) );
pDC->SetBkColor(RGB(212, 208, 200) );
return hbrush;
}
break;
}
pDC->SetTextColor(RGB(0,0,255) );//蓝色
return editbrush;
}
if(nCtlColor==CTLCOLOR_STATIC)
{
if(pWnd->m_hWnd == ((CStatic *)GetDlgItem(IDC_WS1PV))->m_hWnd )
{
pDC->SetTextColor(RGB(0,0,255) ); //蓝色
pDC->SetBkColor(RGB(212, 208, 200) );
return hbrush;
}
if(pWnd->m_hWnd == ((CStatic *)GetDlgItem(IDC_WS2PV))->m_hWnd )
{
pDC->SetTextColor(RGB(0,0,255) ); //蓝色
pDC->SetBkColor(RGB(212, 208, 200) );
return hbrush;
}
pDC->SetTextColor(RGB(0,0,255) ); //蓝色
pDC->SetBkColor(RGB(247, 249, 232) );
return editbrush;
}
/* if(nCtlColor==CTLCOLOR_STATIC)
{
pDC->SetTextColor(RGB(0,0,255) );//蓝色
pDC->SetBkColor(RGB(212, 208, 200) );
return hbrush;
}
*/
return hbrush;
return hbr;
}
BOOL CConWndDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
double dt;
CString string;
hbrush=CreateSolidBrush(RGB(212, 208, 200));
editbrush=CreateSolidBrush(RGB(247, 249, 232));
if(theApp.setup==0)
{
m_auto.m_nColor=14;
m_manul.m_nColor=17;
m_on.m_nColor=18;
m_off.m_nColor=21;
m_r1hoton.m_nColor=30;
m_r1hotoff.m_nColor=33;
m_transon.m_nColor=26;
m_transoff.m_nColor=29;
m_slhoton.m_nColor=34;
m_slhotoff.m_nColor=37;
m_ws1on.m_nColor=38;
m_ws1off.m_nColor=41;
m_ws2on.m_nColor=42;
m_ws2off.m_nColor=45;
m_pwon.m_nColor=46;
m_pwoff.m_nColor=49;
m_zmon.m_nColor=50;//ZMON.BMP ZMOFF.BMP JZMON.BMP JZMOFF.BMP
m_zmoff.m_nColor=51;
m_xzon.m_nColor=54;
m_xzoff.m_nColor=57;
m_qxon.m_nColor=58;
m_qxoff.m_nColor=61;
m_r2hoton.m_nColor=62; //62 63
m_r2hotoff.m_nColor=65;//64 65
m_r3hoton.m_nColor=91; //90 91
m_r3hotoff.m_nColor=92;//92 93
theApp.m_auto_m_nColor=m_auto.m_nColor;
theApp.m_manul_m_nColor=m_manul.m_nColor;
theApp.m_on_m_nColor=m_on.m_nColor;
theApp.m_off_m_nColor=m_off.m_nColor;
theApp.m_r1hoton_m_nColor=m_r1hoton.m_nColor;
theApp.m_r1hotoff_m_nColor=m_r1hotoff.m_nColor;
theApp.m_transon_m_nColor=m_transon.m_nColor;
theApp.m_transoff_m_nColor=m_transoff.m_nColor;
theApp.m_slhoton_m_nColor=m_slhoton.m_nColor;
theApp.m_slhotoff_m_nColor=m_slhotoff.m_nColor;
theApp.m_ws1on_m_nColor=m_ws1on.m_nColor;
theApp.m_ws1off_m_nColor=m_ws1off.m_nColor;
theApp.m_ws2on_m_nColor=m_ws2on.m_nColor;
theApp.m_ws2off_m_nColor=m_ws2off.m_nColor;
theApp.m_pwon_m_nColor=m_pwon.m_nColor;
theApp.m_pwoff_m_nColor=m_pwoff.m_nColor;
theApp.m_zmon_m_nColor=m_zmon.m_nColor;
theApp.m_zmoff_m_nColor=m_zmoff.m_nColor;
theApp.m_xzon_m_nColor=m_xzon.m_nColor;
theApp.m_xzoff_m_nColor=m_xzoff.m_nColor;
theApp.m_qxon_m_nColor=m_qxon.m_nColor;
theApp.m_qxoff_m_nColor=m_qxoff.m_nColor;
theApp.m_r2hoton_m_nColor=m_r2hoton.m_nColor;
theApp.m_r2hotoff_m_nColor=m_r2hotoff.m_nColor;
theApp.m_r3hoton_m_nColor=m_r3hoton.m_nColor;
theApp.m_r3hotoff_m_nColor=m_r3hotoff.m_nColor;
}else
{
m_auto.m_nColor=theApp.m_auto_m_nColor;
m_manul.m_nColor=theApp.m_manul_m_nColor;
m_on.m_nColor=theApp.m_on_m_nColor;
m_off.m_nColor=theApp.m_off_m_nColor;
m_r1hoton.m_nColor=theApp.m_r1hoton_m_nColor;
m_r1hotoff.m_nColor=theApp.m_r1hotoff_m_nColor;
m_transon.m_nColor=theApp.m_transon_m_nColor;
m_transoff.m_nColor=theApp.m_transoff_m_nColor;
m_slhoton.m_nColor=theApp.m_slhoton_m_nColor;
m_slhotoff.m_nColor=theApp.m_slhotoff_m_nColor;
m_ws1on.m_nColor=theApp.m_ws1on_m_nColor;
m_ws1off.m_nColor=theApp.m_ws1off_m_nColor;
m_ws2on.m_nColor=theApp.m_ws2on_m_nColor;
m_ws2off.m_nColor=theApp.m_ws2off_m_nColor;
m_pwon.m_nColor=theApp.m_pwon_m_nColor;
m_pwoff.m_nColor=theApp.m_pwoff_m_nColor;
m_zmon.m_nColor=theApp.m_zmon_m_nColor;
m_zmoff.m_nColor=theApp.m_zmoff_m_nColor;
m_xzon.m_nColor=theApp.m_xzon_m_nColor;
m_xzoff.m_nColor=theApp.m_xzoff_m_nColor;
m_qxon.m_nColor=theApp.m_qxon_m_nColor;
m_qxoff.m_nColor=theApp.m_qxoff_m_nColor;
m_r2hoton.m_nColor=theApp.m_r2hoton_m_nColor;
m_r2hotoff.m_nColor=theApp.m_r2hotoff_m_nColor;
m_r3hoton.m_nColor=theApp.m_r3hoton_m_nColor;
m_r3hotoff.m_nColor=theApp.m_r3hotoff_m_nColor;
}
theApp.setup=0xff;
m_slsts.type=theApp.WorkMode+1;
m_slsts.Invalidate(false);
SetTimer(MainControl_TIMER,1000,NULL);
theApp.ControlMode= MainControl_Window;
dt=theApp.FreqOut[1]/100.0*60.0;
if((dt>=0)&&(dt<3000))
{
string.Format(_T("%4.0f"),dt);
SetDlgItemText(IDC_FAN_PV,string);
}
switch(theApp.wave_type)
{
case 0://高波
if(theApp.Rbt_type==0)
{
m_face_bmp.LoadBitmap(IDB_BITMAP243);//左进
}else
{
m_face_bmp.LoadBitmap(IDB_BITMAP241);//右进
}
break;
case 1://双波
if(theApp.Rbt_type==0)
{
m_face_bmp.LoadBitmap(IDB_BITMAP236);//左进
}else
{
m_face_bmp.LoadBitmap(IDB_BITMAP242);//右进
}
break;
default:m_face_bmp.LoadBitmap(IDB_BITMAP236);
break;
}
HBITMAP hBmp=m_face_bmp.operator HBITMAP();
m_face.SetBitmap(hBmp);
theApp.old_fan_set=30000;
theApp.old_rh1_temper_set =30000;
theApp.old_rh2_temper_set =30000;
theApp.old_rh3_temper_set =30000;
theApp.old_sl_temper_set =30000;
theApp.old_ws1_temper_set =30000;
theApp.old_ws2_temper_set =30000;
theApp.old_trans_speed_set=30000;
PostMessage(WM_TIMER);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CConWndDlg::OnDestroy()
{
CDialog::OnDestroy();
// TODO: Add your message handler code here
KillTimer(MainControl_TIMER);
m_face_bmp.DeleteObject();
DeleteObject(hbrush);
DeleteObject(editbrush);
}
void CConWndDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
unsigned char ch,chh,flag;
CString string,str;
double dt,dx,dy;
int j,i;
string.Format(_T("%4d"),theApp.pw_with_ret);
SetDlgItemText(IDC_BOARDWITH,_T(" ")+string+_T(" mm"));
string.Format(_T("%03.1f"),theApp.temper_value[1]);
SetDlgItemText(IDC_R1HOTPV, _T(" ") + string);
string.Format(_T("%03.1f"),theApp.temper_value[2]);
SetDlgItemText(IDC_R2HOTPV, _T(" ") + string);
string.Format(_T("%03.1f"),theApp.temper_value[3]);
SetDlgItemText(IDC_R3HOTPV, _T(" ") + string);
string.Format(_T("%03.1f"),theApp.temper_value[0]);
SetDlgItemText(IDC_SLPV, _T(" ")+ string);
SetDlgItemText(IDC_BOARDNO,theApp.HwlFileName);
if(theApp.old_fan_set!=theApp.fan_set)
{
string.Format(_T("%4.0f"),theApp.fan_set);
SetDlgItemText(IDC_FAN_SV,string);
theApp.old_fan_set=theApp.fan_set;
}
dt=theApp.FreqOut[1]/100.0*60.0;
if((dt>=0)&&(dt<3000))
{
string.Format(_T("%4.0f"),dt);
SetDlgItemText(IDC_FAN_PV,string);
}
if(theApp.old_rh1_temper_set!=theApp.rh1_temper_set)
{
string.Format(_T("%03.1f"),theApp.rh1_temper_set);
SetDlgItemText(IDC_R1HOTSV,string);
theApp.old_rh1_temper_set=theApp.rh1_temper_set;
}
if(theApp.old_rh2_temper_set!=theApp.rh2_temper_set)
{
string.Format(_T("%03.1f"),theApp.rh2_temper_set);
SetDlgItemText(IDC_R2HOTSV,string);
theApp.old_rh2_temper_set=theApp.rh2_temper_set;
}
if(theApp.old_rh3_temper_set!=theApp.rh3_temper_set)
{
string.Format(_T("%03.1f"),theApp.rh3_temper_set);
SetDlgItemText(IDC_R3HOTSV,string);
theApp.old_rh3_temper_set=theApp.rh3_temper_set;
}
if(theApp.old_sl_temper_set!=theApp.sl_temper_set)
{
string.Format(_T("%03.1f"),theApp.sl_temper_set);
SetDlgItemText(IDC_SLSV,string);
theApp.old_sl_temper_set=theApp.sl_temper_set;
}
if(theApp.old_ws1_temper_set!=theApp.ws1_temper_set)
{
string.Format(_T("%03.1f"),theApp.ws1_temper_set);
SetDlgItemText(IDC_WS1SV,string);
theApp.old_ws1_temper_set=theApp.ws1_temper_set;
}
if(theApp.old_ws2_temper_set!=theApp.ws2_temper_set)
{
string.Format(_T("%03.1f"),theApp.ws2_temper_set);
SetDlgItemText(IDC_WS2SV,string);
theApp.old_ws2_temper_set=theApp.ws2_temper_set;
}
if(theApp.old_trans_speed_set!=theApp.trans_speed_set)
{
string.Format(_T("%03.1f"),theApp.trans_speed_set);
SetDlgItemText(IDC_TRANSSV,string);
theApp.old_trans_speed_set=theApp.trans_speed_set;
}
if(theApp.FreqOut[0]<=10) dt=0;
else dt=theApp.trans_speed_set;
string.Format(_T("%03.1f"),dt);
SetDlgItemText(IDC_TRANSPV,string);
str.Format(_T("%03d"),theApp.date_run);
string=_T(" ")+str+_T("-");
str.Format(_T("%02d"), theApp.hour_run);
string=string+str+_T("-");
str.Format(_T("%02d"), theApp.minute_run);
string=string+str+_T("-");
str.Format(_T("%02d"), theApp.second_run);
string=string+str+_T(" ");
SetDlgItemText(IDC_RUNTIME,string);
str.Format(_T("%4d"), theApp.BoardInCount);
SetDlgItemText(IDC_OUTNUMPV,str);
string.Format(_T("%4d"), theApp.outsum);
SetDlgItemText(IDC_OUTNUMSV,string);
str.Format(_T("%4d"), theApp.pw_len_ret);
SetDlgItemText(IDC_BOARDLENGTH,_T(" ")+str+_T(" mm"));
if(theApp.warncode!=m_warncode.warncode)
{
m_warncode.Invalidate(false);
}
j=0;
if(m_stsinfo.AddHotFlag !=theApp.AddHotFlag) j++;
if(m_stsinfo.HTemperFlag!=theApp.HTemperFlag)j++;
if(m_stsinfo.WarnFlag !=theApp.WarnFlag) j++;
if(j!=0) m_stsinfo.Invalidate(false);
j=(int)theApp.rlscale;
if(j>100) j=100;
str.Format(_T("%3d"), j);
str=str+_T("%");
SetDlgItemText(IDC_SCALE_EDIT,str);
m_scale.Invalidate(false);
// m_stsinfo.Invalidate(TRUE);
if(m_off.m_nColor!=21)
{//调窄
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -