📄 indentview.cpp
字号:
// IndentView.cpp : implementation of the CIndentView class
//
#include "stdafx.h"
#include "Indent.h"
#include "IndentDoc.h"
#include "IndentView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CIndentView
IMPLEMENT_DYNCREATE(CIndentView, CFormView)
BEGIN_MESSAGE_MAP(CIndentView, CFormView)
//{{AFX_MSG_MAP(CIndentView)
ON_BN_CLICKED(IDC_BTN_DEFAULT, OnBtnDefault)
ON_UPDATE_COMMAND_UI(ID_INDENT_NEW_RECORD, OnUpdateIndentNewRecord)
ON_EN_CHANGE(IDC_ITEM01, OnChangeEditItem01)
ON_EN_CHANGE(IDC_ITEM02, OnChangeEditItem02)
ON_EN_CHANGE(IDC_ITEM04, OnChangeEditItem04)
ON_EN_CHANGE(IDC_ITEM06, OnChangeEditItem06)
ON_EN_CHANGE(IDC_ITEM07, OnChangeEditItem07)
ON_EN_CHANGE(IDC_ITEM08, OnChangeEditItem08)
ON_EN_CHANGE(IDC_ITEM09, OnChangeEditItem09)
ON_EN_CHANGE(IDC_ITEM11, OnChangeEditItem11)
ON_EN_CHANGE(IDC_ITEM13, OnChangeEditItem13)
ON_EN_CHANGE(IDC_ITEM14, OnChangeEditItem14)
ON_NOTIFY(DTN_DATETIMECHANGE, IDC_ITEM05, OnDatetimechangeDateItem05)
ON_NOTIFY(DTN_DATETIMECHANGE, IDC_ITEM12, OnDatetimechangeDateItem12)
ON_WM_CREATE()
ON_CBN_SELCHANGE(IDC_ITEM03, OnSelchangeItem03)
ON_CBN_SELCHANGE(IDC_ITEM10, OnSelchangeItem10)
ON_CBN_SELCHANGE(IDC_ITEM15, OnSelchangeItem15)
//}}AFX_MSG_MAP
// Standard printing commands
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CIndentView construction/destruction
CIndentView::CIndentView()
: CFormView(CIndentView::IDD)
{
//{{AFX_DATA_INIT(CIndentView)
//}}AFX_DATA_INIT
// TODO: add construction code here
}
CIndentView::~CIndentView()
{
}
void CIndentView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CIndentView)
//}}AFX_DATA_MAP
}
BOOL CIndentView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CFormView::PreCreateWindow(cs);
}
void CIndentView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
ResizeParentToFit();
SetDlgItemText(IDC_ITEM16,"备注");
CIndentApp* pApp = (CIndentApp*)AfxGetApp();
//基础数据--客户
pApp->m_ado.Execute("SELECT * FROM [client] ORDER BY db_id ASC");
while(!pApp->m_ado.IsEof())
{
((CComboBox*)GetDlgItem(IDC_ITEM03))->AddString((_bstr_t)pApp->m_ado.m_pRts->GetCollect("db_client"));
pApp->m_ado.m_pRts->MoveNext();
}
//基础数据--规格
pApp->m_ado.Execute("SELECT * FROM [spec] ORDER BY db_id ASC");
while(!pApp->m_ado.IsEof())
{
((CComboBox*)GetDlgItem(IDC_ITEM10))->AddString((_bstr_t)pApp->m_ado.m_pRts->GetCollect("db_spec"));
pApp->m_ado.m_pRts->MoveNext();
}
// 基础数据--合同方式
pApp->m_ado.Execute("SELECT * FROM [sort] ORDER BY db_id ASC");
while(!pApp->m_ado.IsEof())
{
((CComboBox*)GetDlgItem(IDC_ITEM15))->AddString((_bstr_t)pApp->m_ado.m_pRts->GetCollect("db_sort"));
pApp->m_ado.m_pRts->MoveNext();
}
}
/////////////////////////////////////////////////////////////////////////////
// CIndentView diagnostics
#ifdef _DEBUG
void CIndentView::AssertValid() const
{
CFormView::AssertValid();
}
void CIndentView::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
CIndentDoc* CIndentView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CIndentDoc)));
return (CIndentDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CIndentView message handlers
void CIndentView::OnBtnDefault()
{
GetNextDlgTabItem(GetFocus())->SetFocus();
}
void CIndentView::OnUpdateIndentNewRecord(CCmdUI* pCmdUI)
{
pCmdUI->Enable(!this);
}
int CIndentView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFormView::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
m_pDoc = GetDocument();
return 0;
}
void CIndentView::OnChangeEditItem01()
{
m_pDoc->SetModifiedFlag(TRUE);
}
void CIndentView::OnChangeEditItem02()
{
m_pDoc->SetModifiedFlag(TRUE);
}
void CIndentView::OnSelchangeItem03()
{
m_pDoc->SetModifiedFlag(TRUE);
}
void CIndentView::OnChangeEditItem04()
{
m_pDoc->SetModifiedFlag(TRUE);
}
void CIndentView::OnChangeEditItem06()
{
m_pDoc->SetModifiedFlag(TRUE);
}
void CIndentView::OnChangeEditItem07()
{
m_pDoc->SetModifiedFlag(TRUE);
}
void CIndentView::OnChangeEditItem08()
{
m_pDoc->SetModifiedFlag(TRUE);
}
void CIndentView::OnChangeEditItem09()
{
m_pDoc->SetModifiedFlag(TRUE);
}
void CIndentView::OnSelchangeItem10()
{
m_pDoc->SetModifiedFlag(TRUE);
}
void CIndentView::OnChangeEditItem11()
{
m_pDoc->SetModifiedFlag(TRUE);
}
void CIndentView::OnChangeEditItem13()
{
m_pDoc->SetModifiedFlag(TRUE);
}
void CIndentView::OnChangeEditItem14()
{
m_pDoc->SetModifiedFlag(TRUE);
}
void CIndentView::OnSelchangeItem15()
{
m_pDoc->SetModifiedFlag(TRUE);
}
void CIndentView::OnDatetimechangeDateItem05(NMHDR* pNMHDR, LRESULT* pResult)
{
m_pDoc->SetModifiedFlag(TRUE);
*pResult = 0;
}
void CIndentView::OnDatetimechangeDateItem12(NMHDR* pNMHDR, LRESULT* pResult)
{
m_pDoc->SetModifiedFlag(TRUE);
*pResult = 0;
}
void CIndentView::OnDraw(CDC* pDC)
{
// TODO: Add your specialized code here and/or call the base class
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -