📄 squarecaldlldlg.cpp
字号:
// SquareCalDllDlg.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "SquareCalDllDlg.h"
#include "SquareCal.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSquareCalDllDlg dialog
CSquareCalDllDlg::CSquareCalDllDlg(CWnd* pParent /*=NULL*/)
: CDialog(CSquareCalDllDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CSquareCalDllDlg)
m_x = 0.0;
m_y = 0.0;
m_result = 0.0;
//}}AFX_DATA_INIT
m_pSet=NULL;
}
void CSquareCalDllDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSquareCalDllDlg)
DDX_Text(pDX, IDC_EDIT1, m_x);
DDX_Text(pDX, IDC_EDIT2, m_y);
DDX_Text(pDX, IDC_EDIT3, m_result);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSquareCalDllDlg, CDialog)
//{{AFX_MSG_MAP(CSquareCalDllDlg)
ON_BN_CLICKED(IDC_ADD, OnAdd)
ON_BN_CLICKED(IDC_MINUS, OnMinus)
ON_BN_CLICKED(IDC_RECORD_FIRST, OnRecordFirst)
ON_BN_CLICKED(IDC_RECORD_PRE, OnRecordPre)
ON_BN_CLICKED(IDC_RECORD_NEXT, OnRecordNext)
ON_BN_CLICKED(IDC_RECORD_LAST, OnRecordLast)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSquareCalDllDlg message handlers
void CSquareCalDllDlg::OnAdd()
{
// TODO: Add your control notification handler code here
UpdateData(true);
CSquareCal cal;
m_result=cal.MyAdd(m_x,m_y);
UpdateData(false);
}
void CSquareCalDllDlg::OnMinus()
{
// TODO: Add your control notification handler code here
UpdateData(true);
CSquareCal cal;
m_result=cal.MyMinus(m_x,m_y);
UpdateData(false);
}
BOOL CSquareCalDllDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_pSet=new CSquaredbSet();
m_pSet->Open();
m_pSet->MoveFirst();
m_x=m_pSet->m_x;
m_y=m_pSet->m_y;
UpdateData(false);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CSquareCalDllDlg::OnRecordFirst()
{
// TODO: Add your control notification handler code here
m_pSet->MoveFirst();
m_x=m_pSet->m_x;
m_y=m_pSet->m_y;
UpdateData(false);
}
void CSquareCalDllDlg::OnRecordPre()
{
// TODO: Add your control notification handler code here
m_pSet->MovePrev();
if(m_pSet->IsBOF())
{
AfxMessageBox("已是首记录!");
m_pSet->MoveFirst();
}
m_x=m_pSet->m_x;
m_y=m_pSet->m_y;
UpdateData(false);
}
void CSquareCalDllDlg::OnRecordNext()
{
// TODO: Add your control notification handler code here
m_pSet->MoveNext();
if(m_pSet->IsEOF())
{
AfxMessageBox("已是末记录!");
m_pSet->MoveLast();
}
m_x=m_pSet->m_x;
m_y=m_pSet->m_y;
UpdateData(false);
}
void CSquareCalDllDlg::OnRecordLast()
{
// TODO: Add your control notification handler code here
m_pSet->MoveLast();
m_x=m_pSet->m_x;
m_y=m_pSet->m_y;
UpdateData(false);
}
/*void CSquareCalDllDlg::OnRecordAdd()
{
// TODO: Add your control notification handler code here
UpdateData(true);
m_pSet->AddNew();
m_pSet->m_x=m_x;
m_pSet->m_y=m_y;
m_pSet->m_result=m_result;
m_pSet->Update();
m_pSet->Requery();
}
void CSquareCalDllDlg::OnRecordDel()
{
// TODO: Add your control notification handler code here
m_pSet->Delete();
if(!m_pSet->IsEOF())
m_pSet->MoveNext();
else
m_pSet->MoveLast();
}
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -