📄 mode.cpp
字号:
// MODE.cpp : implementation file
//
#include "stdafx.h"
#include "HMIcan_usb.h"
#include "MODE.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMODE dialog
CMODE::CMODE(CWnd* pParent /*=NULL*/)
: CDialog(CMODE::IDD, pParent)
{
//{{AFX_DATA_INIT(CMODE)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CMODE::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMODE)
DDX_Control(pDX, IDC_STATIC_TIP_CANCEL1, m_tip_CANCEL);
DDX_Control(pDX, IDC_STATIC_TIP_ENTER1, m_tip_ENTER);
DDX_Control(pDX, IDC_STATIC_TIP_DG161, m_tip_DG161);
DDX_Control(pDX, IDC_STATIC_TIP_DG151, m_tip_DG151);
DDX_Control(pDX, IDC_STATIC_TIP_DG141, m_tip_DG141);
DDX_Control(pDX, IDC_STATIC_TIP_DG131, m_tip_DG131);
DDX_Control(pDX, IDC_STATIC_TIP_DG121, m_tip_DG121);
DDX_Control(pDX, IDC_STATIC_TIP_DG111, m_tip_DG111);
DDX_Control(pDX, IDC_STATIC_TIP_DG101, m_tip_DG101);
DDX_Control(pDX, IDC_STATIC_TIP_DG91, m_tip_DG91);
DDX_Control(pDX, IDC_STATIC_TIP_DG81, m_tip_DG81);
DDX_Control(pDX, IDC_STATIC_TIP_DG71, m_tip_DG71);
DDX_Control(pDX, IDC_STATIC_TIP_DG61, m_tip_DG61);
DDX_Control(pDX, IDC_STATIC_TIP_DG51, m_tip_DG51);
DDX_Control(pDX, IDC_STATIC_TIP_DG41, m_tip_DG41);
DDX_Control(pDX, IDC_STATIC_TIP_DG31, m_tip_DG31);
DDX_Control(pDX, IDC_STATIC_TIP_DG21, m_tip_DG21);
DDX_Control(pDX, IDC_STATIC_TIP_DG11, m_tip_DG11);
DDX_Control(pDX, IDC_STATIC_TIP_AORB, m_tip_AORB);
DDX_Control(pDX, IDC_DG11, m_Dg11);
DDX_Control(pDX, IDC_DG12, m_Dg12);
DDX_Control(pDX, IDC_DG13, m_Dg13);
DDX_Control(pDX, IDC_DG14, m_Dg14);
DDX_Control(pDX, IDC_DG15, m_Dg15);
DDX_Control(pDX, IDC_DG21, m_Dg21);
DDX_Control(pDX, IDC_DG22, m_Dg22);
DDX_Control(pDX, IDC_DG23, m_Dg23);
DDX_Control(pDX, IDC_DG24, m_Dg24);
DDX_Control(pDX, IDC_DG25, m_Dg25);
DDX_Control(pDX, IDC_DG31, m_Dg31);
DDX_Control(pDX, IDC_DG32, m_Dg32);
DDX_Control(pDX, IDC_DG33, m_Dg33);
DDX_Control(pDX, IDC_DG34, m_Dg34);
DDX_Control(pDX, IDC_DG35, m_Dg35);
DDX_Control(pDX, IDC_DG41, m_Dg41);
DDX_Control(pDX, IDC_DG42, m_Dg42);
DDX_Control(pDX, IDC_DG43, m_Dg43);
DDX_Control(pDX, IDC_DG44, m_Dg44);
DDX_Control(pDX, IDC_DG45, m_Dg45);
DDX_Control(pDX, IDC_DG51, m_Dg51);
DDX_Control(pDX, IDC_DG52, m_Dg52);
DDX_Control(pDX, IDC_DG53, m_Dg53);
DDX_Control(pDX, IDC_DG54, m_Dg54);
DDX_Control(pDX, IDC_DG55, m_Dg55);
DDX_Control(pDX, IDC_DG61, m_Dg61);
DDX_Control(pDX, IDC_DG62, m_Dg62);
DDX_Control(pDX, IDC_DG63, m_Dg63);
DDX_Control(pDX, IDC_DG64, m_Dg64);
DDX_Control(pDX, IDC_DG65, m_Dg65);
DDX_Control(pDX, IDC_DG71, m_Dg71);
DDX_Control(pDX, IDC_DG72, m_Dg72);
DDX_Control(pDX, IDC_DG73, m_Dg73);
DDX_Control(pDX, IDC_DG74, m_Dg74);
DDX_Control(pDX, IDC_DG75, m_Dg75);
DDX_Control(pDX, IDC_DG81, m_Dg81);
DDX_Control(pDX, IDC_DG82, m_Dg82);
DDX_Control(pDX, IDC_DG83, m_Dg83);
DDX_Control(pDX, IDC_DG84, m_Dg84);
DDX_Control(pDX, IDC_DG85, m_Dg85);
DDX_Control(pDX, IDC_DG91, m_Dg91);
DDX_Control(pDX, IDC_DG92, m_Dg92);
DDX_Control(pDX, IDC_DG93, m_Dg93);
DDX_Control(pDX, IDC_DG94, m_Dg94);
DDX_Control(pDX, IDC_DG95, m_Dg95);
DDX_Control(pDX, IDC_DG101, m_Dg101);
DDX_Control(pDX, IDC_DG102, m_Dg102);
DDX_Control(pDX, IDC_DG103, m_Dg103);
DDX_Control(pDX, IDC_DG104, m_Dg104);
DDX_Control(pDX, IDC_DG105, m_Dg105);
DDX_Control(pDX, IDC_DG111, m_Dg111);
DDX_Control(pDX, IDC_DG112, m_Dg112);
DDX_Control(pDX, IDC_DG113, m_Dg113);
DDX_Control(pDX, IDC_DG114, m_Dg114);
DDX_Control(pDX, IDC_DG115, m_Dg115);
DDX_Control(pDX, IDC_DG121, m_Dg121);
DDX_Control(pDX, IDC_DG122, m_Dg122);
DDX_Control(pDX, IDC_DG123, m_Dg123);
DDX_Control(pDX, IDC_DG124, m_Dg124);
DDX_Control(pDX, IDC_DG125, m_Dg125);
DDX_Control(pDX, IDC_DG131, m_Dg131);
DDX_Control(pDX, IDC_DG132, m_Dg132);
DDX_Control(pDX, IDC_DG133, m_Dg133);
DDX_Control(pDX, IDC_DG134, m_Dg134);
DDX_Control(pDX, IDC_DG135, m_Dg135);
DDX_Control(pDX, IDC_DG141, m_Dg141);
DDX_Control(pDX, IDC_DG142, m_Dg142);
DDX_Control(pDX, IDC_DG143, m_Dg143);
DDX_Control(pDX, IDC_DG144, m_Dg144);
DDX_Control(pDX, IDC_DG145, m_Dg145);
DDX_Control(pDX, IDC_DG151, m_Dg151);
DDX_Control(pDX, IDC_DG152, m_Dg152);
DDX_Control(pDX, IDC_DG153, m_Dg153);
DDX_Control(pDX, IDC_DG154, m_Dg154);
DDX_Control(pDX, IDC_DG155, m_Dg155);
DDX_Control(pDX, IDC_DG161, m_Dg161);
DDX_Control(pDX, IDC_DG162, m_Dg162);
DDX_Control(pDX, IDC_DG163, m_Dg163);
DDX_Control(pDX, IDC_DG164, m_Dg164);
DDX_Control(pDX, IDC_DG165, m_Dg165);
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMODE, CDialog)
//{{AFX_MSG_MAP(CMODE)
ON_WM_CTLCOLOR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMODE message handlers
BOOL CMODE::PreTranslateMessage(MSG* pMsg)
{
//下移动
if(pMsg->message==WM_KEYDOWN && (pMsg->wParam==VK_DOWN))
{
//焦点在标头的时候
if(CMODE::GetFocus() == GetDlgItem(IDC_STATIC_AORB)||
CMODE::GetFocus() ==GetDlgItem(IDC_CTRL_ORDER1)||
CMODE::GetFocus() ==GetDlgItem(IDC_CTRL_ORDER2)||
CMODE::GetFocus() ==GetDlgItem(IDC_CTRL_ORDER3)||
CMODE::GetFocus() ==GetDlgItem(IDC_CTRL_ORDER4)||
CMODE::GetFocus() ==GetDlgItem(IDC_CTRL_ORDER5)||
CMODE::GetFocus() ==GetDlgItem(IDC_CTRL_ORDER6)||
CMODE::GetFocus() ==GetDlgItem(IDC_CTRL_ORDER7)||
CMODE::GetFocus() ==GetDlgItem(IDC_CTRL_ORDER8)||
CMODE::GetFocus() ==GetDlgItem(IDC_CTRL_ORDER9)||
CMODE::GetFocus() ==GetDlgItem(IDC_CTRL_ORDER10)||
CMODE::GetFocus() ==GetDlgItem(IDC_CTRL_ORDER11)||
CMODE::GetFocus() ==GetDlgItem(IDC_CTRL_ORDER12)||
CMODE::GetFocus() ==GetDlgItem(IDC_CTRL_ORDER13)||
CMODE::GetFocus() ==GetDlgItem(IDC_CTRL_ORDER14)||
CMODE::GetFocus() ==GetDlgItem(IDC_CTRL_ORDER15)||
CMODE::GetFocus() ==GetDlgItem(IDC_CTRL_ORDER16)||
CMODE::GetFocus() ==GetDlgItem(IDC_STATIC_ENTER1)||
CMODE::GetFocus() ==GetDlgItem(IDC_STATIC_CANCEL1))
{
index++;
if(index>18) index=0;
if(index==0)
{
m_static_AORB.SetFocus();
m_static_AORB.bkColor( bk1 );
m_static_CANCEL.bkColor( bk );
m_tip_AORB.ShowWindow(SW_SHOW);
m_tip_CANCEL.ShowWindow(SW_HIDE);
return TRUE;
}
if(index==1)
{
m_static_ORDER1.SetFocus();
m_static_ORDER1.bkColor( bk1 );
m_static_AORB.bkColor( bk );
m_tip_DG11.ShowWindow(SW_SHOW);
m_tip_AORB.ShowWindow(SW_HIDE);
return TRUE;
}
if(index==2)
{
m_static_ORDER2.SetFocus();
m_static_ORDER2.bkColor( bk1 );
m_static_ORDER1.bkColor( bk );
m_tip_DG21.ShowWindow(SW_SHOW);
m_tip_DG11.ShowWindow(SW_HIDE);
return TRUE;
}
if(index==3)
{
m_static_ORDER3.SetFocus();
m_static_ORDER3.bkColor( bk1 );
m_static_ORDER2.bkColor( bk );
m_tip_DG31.ShowWindow(SW_SHOW);
m_tip_DG21.ShowWindow(SW_HIDE);
return TRUE;
}
if(index==4)
{
m_static_ORDER4.SetFocus();
m_static_ORDER4.bkColor( bk1 );
m_static_ORDER3.bkColor( bk );
m_tip_DG41.ShowWindow(SW_SHOW);
m_tip_DG31.ShowWindow(SW_HIDE);
return TRUE;
}
if(index==5)
{
m_static_ORDER5.SetFocus();
m_static_ORDER5.bkColor( bk1 );
m_static_ORDER4.bkColor( bk );
m_tip_DG51.ShowWindow(SW_SHOW);
m_tip_DG41.ShowWindow(SW_HIDE);
return TRUE;
}
if(index==6)
{
m_static_ORDER6.SetFocus();
m_static_ORDER6.bkColor( bk1 );
m_static_ORDER5.bkColor( bk );
m_tip_DG61.ShowWindow(SW_SHOW);
m_tip_DG51.ShowWindow(SW_HIDE);
return TRUE;
}
if(index==7)
{
m_static_ORDER7.SetFocus();
m_static_ORDER7.bkColor( bk1 );
m_static_ORDER6.bkColor( bk );
m_tip_DG71.ShowWindow(SW_SHOW);
m_tip_DG61.ShowWindow(SW_HIDE);
return TRUE;
}
if(index==8)
{
m_static_ORDER8.SetFocus();
m_static_ORDER8.bkColor( bk1 );
m_static_ORDER7.bkColor( bk );
m_tip_DG81.ShowWindow(SW_SHOW);
m_tip_DG71.ShowWindow(SW_HIDE);
return TRUE;
}
if(index==9)
{
m_static_ORDER9.SetFocus();
m_static_ORDER9.bkColor( bk1 );
m_static_ORDER8.bkColor( bk );
m_tip_DG91.ShowWindow(SW_SHOW);
m_tip_DG81.ShowWindow(SW_HIDE);
return TRUE;
}
if(index==10)
{
m_static_ORDER10.SetFocus();
m_static_ORDER10.bkColor( bk1 );
m_static_ORDER9.bkColor( bk );
m_tip_DG101.ShowWindow(SW_SHOW);
m_tip_DG91.ShowWindow(SW_HIDE);
return TRUE;
}
if(index==11)
{
m_static_ORDER11.SetFocus();
m_static_ORDER11.bkColor( bk1 );
m_static_ORDER10.bkColor( bk );
m_tip_DG111.ShowWindow(SW_SHOW);
m_tip_DG101.ShowWindow(SW_HIDE);
return TRUE;
}
if(index==12)
{
m_static_ORDER12.SetFocus();
m_static_ORDER12.bkColor( bk1 );
m_static_ORDER11.bkColor( bk );
m_tip_DG121.ShowWindow(SW_SHOW);
m_tip_DG111.ShowWindow(SW_HIDE);
return TRUE;
}
if(index==13)
{
m_static_ORDER13.SetFocus();
m_static_ORDER13.bkColor( bk1 );
m_static_ORDER12.bkColor( bk );
m_tip_DG131.ShowWindow(SW_SHOW);
m_tip_DG121.ShowWindow(SW_HIDE);
return TRUE;
}
if(index==14)
{
m_static_ORDER14.SetFocus();
m_static_ORDER14.bkColor( bk1 );
m_static_ORDER13.bkColor( bk );
m_tip_DG141.ShowWindow(SW_SHOW);
m_tip_DG131.ShowWindow(SW_HIDE);
return TRUE;
}
if(index==15)
{
m_static_ORDER15.SetFocus();
m_static_ORDER15.bkColor( bk1 );
m_static_ORDER14.bkColor( bk );
m_tip_DG151.ShowWindow(SW_SHOW);
m_tip_DG141.ShowWindow(SW_HIDE);
return TRUE;
}
if(index==16)
{
m_static_ORDER16.SetFocus();
m_static_ORDER16.bkColor( bk1 );
m_static_ORDER15.bkColor( bk );
m_tip_DG161.ShowWindow(SW_SHOW);
m_tip_DG151.ShowWindow(SW_HIDE);
return TRUE;
}
if(index==17)
{
m_static_ENTER.SetFocus();
m_static_ENTER.bkColor( bk1 );
m_static_ORDER16.bkColor( bk );
m_tip_ENTER.ShowWindow(SW_SHOW);
m_tip_DG161.ShowWindow(SW_HIDE);
return TRUE;
}
if(index==18)
{
m_static_CANCEL.SetFocus();
m_static_CANCEL.bkColor( bk1 );
m_static_ENTER.bkColor( bk );
m_tip_CANCEL.ShowWindow(SW_SHOW);
m_tip_ENTER.ShowWindow(SW_HIDE);
return TRUE;
}
}
//在内部下
if(CMODE::GetFocus() == GetDlgItem(IDC_STATIC_DG11)||
CMODE::GetFocus() == GetDlgItem(IDC_STATIC_DG12)||
CMODE::GetFocus() == GetDlgItem(IDC_STATIC_DG13)||
CMODE::GetFocus() == GetDlgItem(IDC_STATIC_DG14)||
CMODE::GetFocus() == GetDlgItem(IDC_STATIC_DG15)||
CMODE::GetFocus() == GetDlgItem(IDC_STATIC_DG16)||
CMODE::GetFocus() == GetDlgItem(IDC_STATIC_DG17_M))
{
CString temp1;
if(index1==0)
{
m_static_DG11.GetWindowText(temp1);
if(temp1=="是")
m_static_DG11.SetWindowText("否");
else
m_static_DG11.SetWindowText("是");
m_static_DG11.RedrawWindow();
return TRUE;
}
if(index1==1)
{
m_static_DG12.GetWindowText(temp1);
if(temp1=="是")
m_static_DG12.SetWindowText("否");
else
m_static_DG12.SetWindowText("是");
m_static_DG12.RedrawWindow();
return TRUE;
}
if(index1==2)
{
m_static_DG13.GetWindowText(temp1);
if(temp1=="是")
m_static_DG13.SetWindowText("否");
else
m_static_DG13.SetWindowText("是");
m_static_DG13.RedrawWindow();
return TRUE;
}
if(index1==3)
{
m_static_DG14.GetWindowText(temp1);
if(temp1=="是")
m_static_DG14.SetWindowText("否");
else
m_static_DG14.SetWindowText("是");
m_static_DG14.RedrawWindow();
return TRUE;
}
if(index1==4)
{
m_static_DG15.GetWindowText(temp1);
if(temp1=="是")
m_static_DG15.SetWindowText("否");
else
m_static_DG15.SetWindowText("是");
m_static_DG15.RedrawWindow();
return TRUE;
}
if(index1==5)
{
m_static_DG16.GetWindowText(temp1);
if(temp1=="200%")
m_static_DG16.SetWindowText("160%");
else if(temp1=="160%")
m_static_DG16.SetWindowText("133%");
else if(temp1=="133%")
m_static_DG16.SetWindowText("114%");
else if(temp1=="114%")
m_static_DG16.SetWindowText("100%");
else if(temp1=="100%")
m_static_DG16.SetWindowText("93%");
else if(temp1=="93%")
m_static_DG16.SetWindowText("87%");
else if(temp1=="87%")
m_static_DG16.SetWindowText("81%");
else if(temp1=="81%")
m_static_DG16.SetWindowText("75%");
else
m_static_DG16.SetWindowText("200%");
m_static_DG16.RedrawWindow();
return TRUE;
}
if(index1==6)
{
m_static_DG17_M.GetWindowText(temp1);
if(temp1=="10")
m_static_DG17_M.SetWindowText("20");
else if(temp1=="20")
m_static_DG17_M.SetWindowText("30");
else if(temp1=="30")
m_static_DG17_M.SetWindowText("40");
else if(temp1=="40")
m_static_DG17_M.SetWindowText("50");
else if(temp1=="50")
m_static_DG17_M.SetWindowText("60");
else if(temp1=="60")
m_static_DG17_M.SetWindowText("70");
else if(temp1=="70")
m_static_DG17_M.SetWindowText("80");
else if(temp1=="80")
m_static_DG17_M.SetWindowText("90");
else if(temp1=="90")
m_static_DG17_M.SetWindowText("100");
else
m_static_DG17_M.SetWindowText("10");
m_static_DG17_M.RedrawWindow();
return TRUE;
}
}
if(CMODE::GetFocus() == GetDlgItem(IDC_STATIC_DG21)||
CMODE::GetFocus() == GetDlgItem(IDC_STATIC_DG22)||
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -