📄 mkjcview.cpp
字号:
// MKJCView.cpp : implementation of the CMKJCView class
//
#include "stdafx.h"
#include "MKJC.h"
#include "MKJCSet.h"
#include "MKJCDoc.h"
#include "MKJCView.h"
#include "DengLu.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMKJCView
IMPLEMENT_DYNCREATE(CMKJCView, CRecordView)
BEGIN_MESSAGE_MAP(CMKJCView, CRecordView)
//{{AFX_MSG_MAP(CMKJCView)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}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()
/////////////////////////////////////////////////////////////////////////////
// CMKJCView construction/destruction
CMKJCView::CMKJCView()
: CRecordView(CMKJCView::IDD)
{
//{{AFX_DATA_INIT(CMKJCView)
// NOTE: the ClassWizard will add member initialization here
m_pSet = NULL;
//}}AFX_DATA_INIT
// TODO: add construction code here
}
CMKJCView::~CMKJCView()
{
}
void CMKJCView::DoDataExchange(CDataExchange* pDX)
{
CRecordView::DoDataExchange(pDX);
m_pSet->Requery();
loop: CDengLu dl;
dl.DoModal();
m_pSet->MoveFirst();
if (dl.m_name.IsEmpty())
{MessageBox("用户名不能为空!");}
m_pSet->m_strFilter.Format("number='%s'",dl.m_name);
if((!m_pSet->IsEOF())&&(m_pSet->m_password==dl.m_psw))
{MessageBox("登陆成功!");
}
else
{MessageBox("登陆失败!");
goto loop;
}
//{{AFX_DATA_MAP(CAView)
//}}AFX_DATA_MAP
//{{AFX_DATA_MAP(CMKJCView)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BOOL CMKJCView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CRecordView::PreCreateWindow(cs);
}
void CMKJCView::OnInitialUpdate()
{
m_pSet = &GetDocument()->m_mKJCSet;
CRecordView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();
}
/////////////////////////////////////////////////////////////////////////////
// CMKJCView printing
BOOL CMKJCView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CMKJCView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CMKJCView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CMKJCView diagnostics
#ifdef _DEBUG
void CMKJCView::AssertValid() const
{
CRecordView::AssertValid();
}
void CMKJCView::Dump(CDumpContext& dc) const
{
CRecordView::Dump(dc);
}
CMKJCDoc* CMKJCView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMKJCDoc)));
return (CMKJCDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMKJCView database support
CRecordset* CMKJCView::OnGetRecordset()
{
return m_pSet;
}
/////////////////////////////////////////////////////////////////////////////
// CMKJCView message handlers
void CMKJCView::OnDraw(CDC* pDC)
{
int t=0;
CMKJCDoc*pDoc=GetDocument();
ASSERT_VALID(pDoc);
CRect rectClient;
GetClientRect(rectClient);
pDC->SetMapMode(MM_LOENGLISH);
pDC->SetWindowExt(10,10);
pDC->SetViewportExt(rectClient.right,rectClient.bottom);
pDC->SetViewportOrg(rectClient.right*7/24,rectClient.bottom/3);
pDC->MoveTo(0,0);
pDC->LineTo(t,m_pSet->m_YDMB);
CPen penBlack;
penBlack.CreatePen(PS_SOLID,1,RGB(0,0,0));
CPen*pOldPen=pDC->SelectObject(&penBlack);
pDC->MoveTo(0,0);
pDC->LineTo(0,200);
pDC->LineTo(5,195);
pDC->MoveTo(0,200);
pDC->LineTo(-5,195);
pDC->MoveTo(0,0);
pDC->LineTo(200,0);
pDC->LineTo(195,5);
pDC->MoveTo(200,0);
pDC->LineTo(195,-5);
pDC->MoveTo(0,0);
for(;!m_pSet->IsEOF();)
{ t=(t+1);
pDC->LineTo(t,m_pSet->m_YDMB);
pDC->SelectObject(pOldPen);
m_pSet->MoveNext();}
pDC->SetViewportOrg(rectClient.right*17/24+m_pSet->m_YDWZ_X,rectClient.bottom*1/3+m_pSet->m_YDWZ_Y);
pDC->Ellipse(-10,-10,10,10);
m_pSet->MoveFirst();
m_pSet->Requery();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -