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

📄 keynumber.cpp

📁 机械手IPC控制器伺服运动程序
💻 CPP
字号:
// KeyNumber.cpp : implementation file
//

#include "stdafx.h"
#include "alfa.h"
#include "KeyNumber.h"
//#include "Main.h"
//#include "TeachMode.h"
//#include "Mline.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

int KeyIn_Flag=0;

/////////////////////////////////////////////////////////////////////////////
// CKeyNumber dialog


CKeyNumber::CKeyNumber(CWnd* pParent /*=NULL*/)
	: CDialog(CKeyNumber::IDD, pParent)
{
	//{{AFX_DATA_INIT(CKeyNumber)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
//	if(num!="")
//	{
//		num=num.Left(num.GetLength()-1);
//	    edt->SetWindowText(num);
//	}

}


BOOL CKeyNumber::OnInitDialog() 
{
	CDialog::OnInitDialog();
//	CRect rt;
	// TODO: Add extra initialization here
	//MoveWindow(0);
 //   SetWindowPos(NULL, 0, 0, 200, 80, nFlags);
    Caps_Flag=0;
	return TRUE;
	// return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}


void CKeyNumber::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CKeyNumber)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CKeyNumber, CDialog)
	//{{AFX_MSG_MAP(CKeyNumber)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
	ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
	ON_BN_CLICKED(IDC_BUTTON5, OnButton5)
	ON_BN_CLICKED(IDC_BUTTON6, OnButton6)
	ON_BN_CLICKED(IDC_BUTTON7, OnButton7)
	ON_BN_CLICKED(IDC_BUTTON8, OnButton8)
	ON_BN_CLICKED(IDC_BUTTON9, OnButton9)
	ON_BN_CLICKED(IDC_BUTTON10, OnButton10)
	ON_BN_CLICKED(IDC_BUTTON12, OnButton12)
	ON_BN_CLICKED(IDC_BUTTON11, OnButton11)
	ON_WM_LBUTTONDOWN()
	ON_BN_CLICKED(IDC_BUTTON13, OnButton13)
	ON_BN_CLICKED(IDC_BUTTON14, OnButton14)
	ON_BN_CLICKED(IDC_BUTTON15, OnButtonQ)
	ON_BN_CLICKED(IDC_BUTTON16, OnButtonW)
	ON_BN_CLICKED(IDC_BUTTON17, OnButtonE)
	ON_BN_CLICKED(IDC_BUTTON18, OnButtonR)
	ON_BN_CLICKED(IDC_BUTTON19, OnButtonT)
	ON_BN_CLICKED(IDC_BUTTON20, OnButtonY)
	ON_BN_CLICKED(IDC_BUTTON21, OnButtonU)
	ON_BN_CLICKED(IDC_BUTTON22, OnButtonI)
	ON_BN_CLICKED(IDC_BUTTON23, OnButtonO)
	ON_BN_CLICKED(IDC_BUTTON24, OnButtonP)
	ON_BN_CLICKED(IDC_BUTTON25, OnButtonA)
	ON_BN_CLICKED(IDC_BUTTON26, OnButtonS)
	ON_BN_CLICKED(IDC_BUTTON27, OnButtonD)
	ON_BN_CLICKED(IDC_BUTTON28, OnButtonF)
	ON_BN_CLICKED(IDC_BUTTON29, OnButtonG)
	ON_BN_CLICKED(IDC_BUTTON30, OnButtonH)
	ON_BN_CLICKED(IDC_BUTTON31, OnButtonJ)
	ON_BN_CLICKED(IDC_BUTTON32, OnButtonK)
	ON_BN_CLICKED(IDC_BUTTON33, OnButtonL)
	ON_BN_CLICKED(IDC_BUTTON34, OnButtonZ)
	ON_BN_CLICKED(IDC_BUTTON35, OnButtonX)
	ON_BN_CLICKED(IDC_BUTTON36, OnButtonC)
	ON_BN_CLICKED(IDC_BUTTON37, OnButtonV)
	ON_BN_CLICKED(IDC_BUTTON38, OnButtonB)
	ON_BN_CLICKED(IDC_BUTTON39, OnButtonN)
	ON_BN_CLICKED(IDC_BUTTON40, OnButtonM)
	ON_BN_CLICKED(IDC_BUTTONCLR, OnButtonCLR)
	ON_BN_CLICKED(IDC_BUTTONCAP, OnButtonCAP)
	ON_BN_CLICKED(IDC_BUTTONSLASH, OnButtonSLASH)
	ON_WM_SHOWWINDOW()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CKeyNumber message handlers

void CKeyNumber::OnShowWindow(BOOL bShow, UINT nStatus) 
{
	CDialog::OnShowWindow(bShow, nStatus);
	
	// TODO: Add your message handler code here
	CRect rt;
    GetWindowRect(rt);
//	MoveWindow(rt.left-(int)(rt.Width()*0.475), rt.top-(int)(rt.Height()*1.35),
//		       rt.Width(), rt.Height());
	MoveWindow(rt.left-(int)(rt.Width()*0.385), rt.top-(int)(rt.Height()*1.35),
		       rt.Width(), rt.Height());  
    if(Caps_Flag==0)  GetDlgItem(IDC_BUTTONCAP)->SetWindowText("Lows");
	else { Caps_Flag=1;  GetDlgItem(IDC_BUTTONCAP)->SetWindowText("Caps"); }

}


void CKeyNumber::OnButton1() 
{
    // TODO: Add your control notification handler code here
	num.Insert(num.GetLength(), "1");
	edt->SetWindowText(num);
}


void CKeyNumber::OnButton2() 
{
	// TODO: Add your control notification handler code here
	num.Insert(num.GetLength(), "2");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButton3() 
{
	// TODO: Add your control notification handler code here
	num.Insert(num.GetLength(), "3");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButton4() 
{
	// TODO: Add your control notification handler code here
	num.Insert(num.GetLength(), "4");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButton5() 
{
	// TODO: Add your control notification handler code here
	num.Insert(num.GetLength(), "5");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButton6() 
{
	// TODO: Add your control notification handler code here
	num.Insert(num.GetLength(), "6");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButton7() 
{
	// TODO: Add your control notification handler code here
	num.Insert(num.GetLength(), "7");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButton8() 
{
	// TODO: Add your control notification handler code here
	num.Insert(num.GetLength(), "8");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButton9() 
{
	// TODO: Add your control notification handler code here
	num.Insert(num.GetLength(), "9");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButton10() 
{
	// TODO: Add your control notification handler code here
	num.Insert(num.GetLength(), "0");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButton12() 
{
	// TODO: Add your control notification handler code here
	if(num!="")
	{
		num=num.Left(num.GetLength()-1);
	    edt->SetWindowText(num);
	}
}

// Exit
void CKeyNumber::OnButton11() 
{
	// TODO: Add your control notification handler code here
	DataChanged=1;
	EndDialog(1);
}

void CKeyNumber::OnLButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	PostMessage(WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(point.x, point.y));
	CDialog::OnLButtonDown(nFlags, point);
}

void CKeyNumber::OnButton13() 
{
	// TODO: Add your control notification handler code here
	num.Insert(num.GetLength(), "-");
    edt->SetWindowText(num);
}

void CKeyNumber::OnButton14() 
{
	// TODO: Add your control notification handler code here
	if(num.GetLength()<=0) return;
	num.Insert(num.GetLength(), ".");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonQ() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) num.Insert(num.GetLength(), "q");
    else             num.Insert(num.GetLength(), "Q");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonW() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) num.Insert(num.GetLength(), "w");
    else             num.Insert(num.GetLength(), "W");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonE() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) num.Insert(num.GetLength(), "e");
    else             num.Insert(num.GetLength(), "E");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonR() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) num.Insert(num.GetLength(), "r");
    else             num.Insert(num.GetLength(), "R");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonT() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) num.Insert(num.GetLength(), "t");
    else             num.Insert(num.GetLength(), "T");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonY() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) num.Insert(num.GetLength(), "y");
    else             num.Insert(num.GetLength(), "Y");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonU() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) num.Insert(num.GetLength(), "u");
    else             num.Insert(num.GetLength(), "U");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonI() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) num.Insert(num.GetLength(), "i");
    else             num.Insert(num.GetLength(), "I");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonO() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) num.Insert(num.GetLength(), "o");
    else             num.Insert(num.GetLength(), "O");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonP() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) num.Insert(num.GetLength(), "p");
    else             num.Insert(num.GetLength(), "P");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonA() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) num.Insert(num.GetLength(), "a");
    else             num.Insert(num.GetLength(), "A");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonS() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) num.Insert(num.GetLength(), "s");
    else             num.Insert(num.GetLength(), "S");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonD() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) num.Insert(num.GetLength(), "d");
    else             num.Insert(num.GetLength(), "D");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonF() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) num.Insert(num.GetLength(), "f");
    else             num.Insert(num.GetLength(), "F");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonG() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) num.Insert(num.GetLength(), "g");
    else             num.Insert(num.GetLength(), "G");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonH() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) num.Insert(num.GetLength(), "h");
    else             num.Insert(num.GetLength(), "H");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonJ() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) num.Insert(num.GetLength(), "j");
    else             num.Insert(num.GetLength(), "J");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonK() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) num.Insert(num.GetLength(), "k");
    else             num.Insert(num.GetLength(), "K");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonL() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) num.Insert(num.GetLength(), "l");
    else             num.Insert(num.GetLength(), "L");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonZ() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) num.Insert(num.GetLength(), "z");
    else             num.Insert(num.GetLength(), "Z");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonX() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) num.Insert(num.GetLength(), "x");
    else             num.Insert(num.GetLength(), "X");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonC() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) num.Insert(num.GetLength(), "c");
    else             num.Insert(num.GetLength(), "C");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonV() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) num.Insert(num.GetLength(), "v");
    else             num.Insert(num.GetLength(), "V");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonB() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) num.Insert(num.GetLength(), "b");
    else             num.Insert(num.GetLength(), "B");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonN() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) num.Insert(num.GetLength(), "n");
    else             num.Insert(num.GetLength(), "N");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonM() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) num.Insert(num.GetLength(), "m");
    else             num.Insert(num.GetLength(), "M");
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonCAP() 
{
	// TODO: Add your control notification handler code here
    if(Caps_Flag==0) { Caps_Flag=1;  GetDlgItem(IDC_BUTTONCAP)->SetWindowText("Caps"); }
	else             { Caps_Flag=0;  GetDlgItem(IDC_BUTTONCAP)->SetWindowText("Lows"); }
}

void CKeyNumber::OnButtonCLR() 
{
	num="";
	edt->SetWindowText(num);
}

void CKeyNumber::OnButtonSLASH() 
{
	num.Insert(num.GetLength(), "/");
	edt->SetWindowText(num);
}

⌨️ 快捷键说明

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