// Student1.h: interface for the CStudent class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_STUDENT1_H__6C489F85_8EF3_473A_BD60_004F7B036622__INCLUDED_)
#define AFX_STUDENT1_H__6C489F85_8EF3_473A_BD60_004F7B036622__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class XStudent
{
public:
XStudent();
XStudent(const XString &name,int num,int score);
void Display(CDC*,int,int);
virtual ~XStudent();
private:
XString name;
int num;
int score ;
};
#endif // !defined(AFX_STUDENT1_H__6C489F85_8EF3_473A_BD60_004F7B036622__INCLUDED_)
// Student1.cpp: implementation of the CStudent class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "student.h"
#include "Student1.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
XStudent::XStudent(const CString &name,int n,int s):name(name),num(n),score(s)
{
}
void XStudent::Display(CDC *pDC,int x,int y)
{
CString str;
str.Format("姓名:%s,学号:%d,分数:%d",name,num,score);
pDC->TextOut(x,y,str);
}
XStudent::~XStudent()
{
}
#include "stdafx.h"
#include "student.h"
#include "studentDoc.h"
#include "studentView.h"
#include "Student1.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// XStudentView
IMPLEMENT_DYNCREATE(XStudentView, XView)
BEGIN_MESSAGE_MAP(XStudentView, XView)
//{{AFX_MSG_MAP(XStudentView)
// 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, XView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// XStudentView construction/destruction
XStudentView::XStudentView()
{
// TODO: add construction code here
}
XStudentView::~XStudentView()
{
}
BOOL XStudentView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// XStudentView drawing
void XStudentView::OnDraw(CDC* pDC)
{
XStudentDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CStudent st1("李姗",201258503105,60);
st1.Display(pDC,20,20);
}
/////////////////////////////////////////////////////////////////////////////
// XStudentView printing
BOOL XStudentView::OnPreparePrinting(XPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void XStudentView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void XStudentView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// XStudentView diagnostics
#ifdef _DEBUG
void CStudentView::AssertValid() const
{
XView::AssertValid();
}
void CStudentView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CStudentDoc* CStudentView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CStudentDoc)));
return (CStudentDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// XStudentView message handlers