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

📄 wyspview.cpp

📁 企业合通管理系统以企业合同为主线
💻 CPP
字号:
// wyspView.cpp : implementation of the CWyspView class
//

#include "stdafx.h"
#include "htglxt.h"

#include "MyDoc.h"
#include "wyspView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CWyspView

IMPLEMENT_DYNCREATE(CWyspView, CScrollView)

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

/////////////////////////////////////////////////////////////////////////////
// CWyspView construction/destruction

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

}

CWyspView::~CWyspView()
{
}

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

	return CScrollView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CWyspView drawing

void CWyspView::OnDraw(CDC* pDC)
{
	CMyDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	Print(0.378, 0.2,pDC);
}

void CWyspView::OnInitialUpdate()
{
	CScrollView::OnInitialUpdate();
	CDC * pDC;
	pDC=this->GetDC();
	memDC.CreateCompatibleDC(pDC);
	bmp.LoadBitmap(IDB_WYSPVIEW);
	memDC.SelectObject(&bmp);
	BITMAP bits;
	bmp.GetBitmap(&bits);
	CSize sizeTotal;
	// TODO: calculate the total size of this view
	sizeTotal.cx =bits.bmWidth-100;
	sizeTotal.cy=bits.bmHeight+100;
	SetScrollSizes(MM_TEXT, sizeTotal);
	
	if(PrintID.IsEmpty())
		return;
	CString sSQL;
	RxRecordset drst;
	sSQL.Format("SELECT * FROM 违约索赔视图 WHERE 编号='%s'",PrintID);
	drst.Open(sSQL,adCmdText);
	if(drst.GetRecordCount()<1)
		return;
	sHTBH=drst.GetFieldValue("合同号");
	sXMMC=drst.GetFieldValue("项目名称");
	sBMMC=drst.GetFieldValue("部门名称");
	sWTRQ=drst.GetFieldValue("问题日期");
	sWTNR=drst.GetFieldValue("问题内容");
	sJSJG=drst.GetFieldValue("交涉结果");
	sFZE=drst.GetFieldValue("负责人");
	sSPQK=drst.GetFieldValue("索赔情况");
}

/////////////////////////////////////////////////////////////////////////////
// CWyspView printing

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

void CWyspView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
{
	LPDEVMODE mode;
	mode=pInfo->m_pPD->GetDevMode();
	int xPix=pDC->GetDeviceCaps(HORZRES);
	int yPix=pDC->GetDeviceCaps(VERTRES);
	Ratio.x=(float)xPix/(float)mode->dmPaperWidth;
	Ratio.y=(float)yPix/(float)mode->dmPaperLength;
}

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

/////////////////////////////////////////////////////////////////////////////
// CWyspView diagnostics

#ifdef _DEBUG
void CWyspView::AssertValid() const
{
	CScrollView::AssertValid();
}

void CWyspView::Dump(CDumpContext& dc) const
{
	CScrollView::Dump(dc);
}

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

/////////////////////////////////////////////////////////////////////////////
// CWyspView message handlers

BOOL CWyspView::DestroyWindow() 
{
	memDC.DeleteDC();
	bmp.DeleteObject();	
	
	return CScrollView::DestroyWindow();
}

void CWyspView::OnPrint(CDC* pDC, CPrintInfo* pInfo) 
{
	Print(Ratio.x, Ratio.y,pDC);
	
	//CScrollView::OnPrint(pDC, pInfo);
}

void CWyspView::Print(float x, float y, CDC *pDC)
{
	int xPix=pDC->GetDeviceCaps(HORZRES);
	int yPix=pDC->GetDeviceCaps(VERTRES);

	BITMAP bitstruct;
	bmp.GetBitmap(&bitstruct);
	pDC->SetMapMode(MM_TEXT);
	CRect rect(0,0,xPix,yPix);

	//变比载入图片
	pDC->StretchBlt(xPix/15,yPix/15,xPix-2*(xPix/15),yPix-2*(yPix/15),&memDC,0,0,bitstruct.bmWidth,bitstruct.bmHeight,SRCCOPY);

	pDC->TextOut(450*x,512*y,PrintID);
	pDC->TextOut(1250*x,512*y,sHTBH);
	pDC->TextOut(450*x,603*y,sBMMC);
	pDC->TextOut(1250*x,603*y,sXMMC);
	pDC->TextOut(540*x,695*y,sWTRQ);
	rect=CRect(300*x,875*y,xPix-(300*x),1600*y );
	pDC->DrawText(sWTNR,&rect,DT_WORDBREAK);
	rect=CRect(300*x,1795*y,xPix-(300*x),2500*y );
	pDC->DrawText(sJSJG,&rect,DT_WORDBREAK);
	pDC->TextOut(500*x,2550*y,sFZE);
	pDC->TextOut(1060*x,2555*y,sSPQK);

}

⌨️ 快捷键说明

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