📄 keynumberfull.cpp
字号:
// KeyNumberFull.cpp : implementation file
//
#include "stdafx.h"
#include "alfa.h"
#include "KeyNumberFull.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// KeyNumberFull dialog
KeyNumberFull::KeyNumberFull(CWnd* pParent /*=NULL*/)
: CDialog(KeyNumberFull::IDD, pParent)
{
//{{AFX_DATA_INIT(KeyNumberFull)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
BOOL KeyNumberFull::OnInitDialog()
{
CDialog::OnInitDialog();
// CRect rt;
// TODO: Add extra initialization here
//MoveWindow(0);
// SetWindowPos(NULL, 0, 0, 200, 80, nFlags);
return TRUE;
// return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void KeyNumberFull::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(KeyNumberFull)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(KeyNumberFull, CDialog)
//{{AFX_MSG_MAP(KeyNumberFull)
ON_BN_CLICKED(IDC_BUTTONV1, OnButton1)
ON_BN_CLICKED(IDC_BUTTONV2, OnButton2)
ON_BN_CLICKED(IDC_BUTTONV3, OnButton3)
ON_BN_CLICKED(IDC_BUTTONV4, OnButton4)
ON_BN_CLICKED(IDC_BUTTONV5, OnButton5)
ON_BN_CLICKED(IDC_BUTTONV6, OnButton6)
ON_BN_CLICKED(IDC_BUTTONV7, OnButton7)
ON_BN_CLICKED(IDC_BUTTONV8, OnButton8)
ON_BN_CLICKED(IDC_BUTTONV9, OnButton9)
ON_BN_CLICKED(IDC_BUTTONV0, OnButton10)
ON_BN_CLICKED(IDC_BUTTONVDOT, OnButtonDot)
ON_BN_CLICKED(IDC_BUTTONVBACK, OnButtonBack)
ON_BN_CLICKED(IDC_BUTTONVCLR, OnButtonClr)
ON_BN_CLICKED(IDC_BUTTONVMINUS, OnButtonMinus)
ON_BN_CLICKED(IDC_BUTTONVEXIT, OnButtonExit)
ON_WM_LBUTTONDOWN()
ON_WM_SHOWWINDOW()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// KeyNumberFull message handlers
void KeyNumberFull::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()*2.20), rt.top-(int)(rt.Height()*1.05),
rt.Width(), rt.Height());
}
void KeyNumberFull::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 KeyNumberFull::OnButton1()
{
// TODO: Add your control notification handler code here
num.Insert(num.GetLength(), "1");
edt->SetWindowText(num);
}
void KeyNumberFull::OnButton2()
{
// TODO: Add your control notification handler code here
num.Insert(num.GetLength(), "2");
edt->SetWindowText(num);
}
void KeyNumberFull::OnButton3()
{
// TODO: Add your control notification handler code here
num.Insert(num.GetLength(), "3");
edt->SetWindowText(num);
}
void KeyNumberFull::OnButton4()
{
// TODO: Add your control notification handler code here
num.Insert(num.GetLength(), "4");
edt->SetWindowText(num);
}
void KeyNumberFull::OnButton5()
{
// TODO: Add your control notification handler code here
num.Insert(num.GetLength(), "5");
edt->SetWindowText(num);
}
void KeyNumberFull::OnButton6()
{
// TODO: Add your control notification handler code here
num.Insert(num.GetLength(), "6");
edt->SetWindowText(num);
}
void KeyNumberFull::OnButton7()
{
// TODO: Add your control notification handler code here
num.Insert(num.GetLength(), "7");
edt->SetWindowText(num);
}
void KeyNumberFull::OnButton8()
{
// TODO: Add your control notification handler code here
num.Insert(num.GetLength(), "8");
edt->SetWindowText(num);
}
void KeyNumberFull::OnButton9()
{
// TODO: Add your control notification handler code here
num.Insert(num.GetLength(), "9");
edt->SetWindowText(num);
}
void KeyNumberFull::OnButton10()
{
// TODO: Add your control notification handler code here
num.Insert(num.GetLength(), "0");
edt->SetWindowText(num);
}
void KeyNumberFull::OnButtonDot()
{
// TODO: Add your control notification handler code here
if(num.GetLength()<=0) return;
num.Insert(num.GetLength(), ".");
edt->SetWindowText(num);
}
void KeyNumberFull::OnButtonBack()
{
// TODO: Add your control notification handler code here
if(num!="")
{
num=num.Left(num.GetLength()-1);
edt->SetWindowText(num);
}
}
void KeyNumberFull::OnButtonClr()
{
num="";
edt->SetWindowText(num);
}
void KeyNumberFull::OnButtonMinus()
{
// TODO: Add your control notification handler code here
num.Insert(num.GetLength(), "-");
edt->SetWindowText(num);
}
void KeyNumberFull::OnButtonExit()
{
// TODO: Add your control notification handler code here
if(num.GetLength()<=0) {
num.Insert(num.GetLength(), "0");
edt->SetWindowText(num);
}
DataChanged=1;
EndDialog(1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -