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

📄 商品交易系统view.cpp

📁 商品交易系统
💻 CPP
字号:
// 商品交易系统View.cpp : implementation of the CMyView class
//

#include "stdafx.h"
#include "商品交易系统.h"

#include "商品交易系统Set.h"
#include "商品交易系统Doc.h"
#include "商品交易系统View.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMyView

IMPLEMENT_DYNCREATE(CMyView, CRecordView)

BEGIN_MESSAGE_MAP(CMyView, CRecordView)
	//{{AFX_MSG_MAP(CMyView)
	ON_BN_CLICKED(IDC_BUTTONADDNEW, OnButtonaddnew)
	ON_BN_CLICKED(IDC_BUTTONOK, OnButtonok)
	ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
	ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CRecordView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CRecordView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CRecordView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMyView construction/destruction

CMyView::CMyView()
	: CRecordView(CMyView::IDD)
{
	//{{AFX_DATA_INIT(CMyView)
	m_pSet = NULL;
	//}}AFX_DATA_INIT
	// TODO: add construction code here

}

CMyView::~CMyView()
{
}

void CMyView::DoDataExchange(CDataExchange* pDX)
{
	CRecordView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CMyView)
	DDX_FieldText(pDX, IDC_EDITJG, m_pSet->m_JG, m_pSet);
	DDX_FieldText(pDX, IDC_EDITJS, m_pSet->m_JS, m_pSet);
	DDX_FieldText(pDX, IDC_EDITJYRQ, m_pSet->m_JYRQ, m_pSet);
	DDX_FieldText(pDX, IDC_EDITSPBH, m_pSet->m_SPBH, m_pSet);
	DDX_FieldText(pDX, IDC_EDITSPMC, m_pSet->m_SPMC, m_pSet);
	DDX_FieldText(pDX, IDC_EDITXJ, m_pSet->m_XJ, m_pSet);
	//}}AFX_DATA_MAP
}

BOOL CMyView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CRecordView::PreCreateWindow(cs);
}

void CMyView::OnInitialUpdate()
{
	m_pSet = &GetDocument()->m_mySet;
	CRecordView::OnInitialUpdate();
	GetParentFrame()->RecalcLayout();
	ResizeParentToFit();

}

/////////////////////////////////////////////////////////////////////////////
// CMyView printing

BOOL CMyView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CMyView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CMyView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CMyView diagnostics

#ifdef _DEBUG
void CMyView::AssertValid() const
{
	CRecordView::AssertValid();
}

void CMyView::Dump(CDumpContext& dc) const
{
	CRecordView::Dump(dc);
}

CMyDoc* CMyView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMyDoc)));
	return (CMyDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMyView database support
CRecordset* CMyView::OnGetRecordset()
{
	return m_pSet;
}


/////////////////////////////////////////////////////////////////////////////
// CMyView message handlers

void CMyView::OnButtonaddnew() 
{
	// TODO: Add your control notification handler code here
	m_pSet->AddNew();
	UpdateData(FALSE);
}

void CMyView::OnButtonok() 
{
	// TODO: Add your control notification handler code here
	UpdateData();
	m_pSet->Edit(); 
    int value;
    sscanf((LPCTSTR)m_pSet->m_JG,"%d",&value); 
	m_pSet->m_XJ=(value)*(m_pSet->m_JS);
	UpdateData(TRUE);
}
#include"MyDlg1.h"
void CMyView::OnRadio1() 
{
	// TODO: Add your control notification handler code here
	CMyDlg1 MyDlg1;
	MyDlg1.DoModal();
}
#include"MyDlg2.h"
void CMyView::OnRadio2() 
{
	// TODO: Add your control notification handler code here
	CMyDlg2 MyDlg2;
	MyDlg2.DoModal();
}

⌨️ 快捷键说明

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