www.gusucode.com > VC++企业培训管理系统-源码程序 > VC++企业培训管理系统-源码程序/code/企业培训管理系统View.cpp

    //Download by http://www.NewXing.com
// 企业培训管理系统View.cpp : implementation of the CMyView class
//

#include "stdafx.h"
#include "企业培训管理系统.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, CView)

BEGIN_MESSAGE_MAP(CMyView, CView)
	//{{AFX_MSG_MAP(CMyView)
		// 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, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

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

CMyView::CMyView()
{
	// TODO: add construction code here

}

CMyView::~CMyView()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CMyView drawing

void CMyView::OnDraw(CDC* pDC)
{
	CMyDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	CBitmap m_bmp;
	m_bmp.LoadBitmap(IDB_BITMAP2);
	BITMAP bm;
	m_bmp.GetObject(sizeof(BITMAP),&bm);
	CDC dcMem;
	dcMem.CreateCompatibleDC(pDC);
	CBitmap *poldbmp=dcMem.SelectObject(&m_bmp);
	pDC->BitBlt(0,0,bm.bmWidth+200,bm.bmHeight,&dcMem,0,0,SRCCOPY);
	dcMem.SelectObject(poldbmp);
		
    CWindowDC dc(GetParent());
	LOGFONT lf;
	memset(&lf,0,sizeof(LOGFONT));
    lf.lfHeight=60;                                     //直接设置字体属性      
	lf.lfCharSet=GB2312_CHARSET;
	strcpy((LPSTR)&(lf.lfFaceName),"仿宋");
    CFont cf;

	   
	cf.CreateFontIndirect(&lf);
	
	CFont* oldfont=dc.SelectObject(&cf);
	dc.SetTextColor(RGB(240,100,0));
    dc.TextOut(300,300,"企业培训管理系统");
	lf.lfHeight=50;
	dc.SelectObject(oldfont);
	cf.DeleteObject();
	
	dc.SelectObject(&lf);
	dc.TextOut(800,400,"学校:石家庄学院");
	dc.TextOut(800,450,"专业:09计算机科学与技术专业");
	dc.TextOut(800,500,"小组成员:曹丙瑞(20081301064)");
	dc.TextOut(880,550,"    ");
	dc.TextOut(880,600,"    ");
    dc.TextOut(800,650,"时间:2011.12.15");
    dc.SelectObject(oldfont);
	cf.DeleteObject();
  //  dc.SetBkColor(RGB(0,0,255));



	// TODO: add draw code for native data here
}
	// TODO: add draw code for native data here


/////////////////////////////////////////////////////////////////////////////
// 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
{
	CView::AssertValid();
}

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

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

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