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

📄 htggview.cpp

📁 1)C++源代码扫描程序识别C++记号。 C++语言包含了几种类型的记号:标识符
💻 CPP
字号:
// htggView.cpp : implementation of the CHtggView class
//

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

#include "MyDoc.h"
#include "htggView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CHtggView

IMPLEMENT_DYNCREATE(CHtggView, CScrollView)

BEGIN_MESSAGE_MAP(CHtggView, CScrollView)
	//{{AFX_MSG_MAP(CHtggView)
		// 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()

/////////////////////////////////////////////////////////////////////////////
// CHtggView construction/destruction

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

}

CHtggView::~CHtggView()
{
}

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

	return CScrollView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CHtggView drawing

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

}

void CHtggView::OnInitialUpdate()
{
	CScrollView::OnInitialUpdate();

	CDC * pDC;
	pDC=this->GetDC();
	memDC.CreateCompatibleDC(pDC);
	bmp.LoadBitmap(IDB_HTGGVIEW);
	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("项目名称");
	sGGNR=drst.GetFieldValue("更改内容");
	sHTQSR=drst.GetFieldValue("合同签署人");
	sHTGGQSR=drst.GetFieldValue("合同更改签署人");
	sZBBM=drst.GetFieldValue("主办部门");
	sHTGGSXRQ=drst.GetFieldValue("合同更改生效日期");
	sCSRQ=drst.GetFieldValue("抄送日期");
	sBZ=drst.GetFieldValue("备注");
	sXMZG=drst.GetFieldValue("项目主管");
}
/////////////////////////////////////////////////////////////////////////////
// CHtggView printing

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

void CHtggView::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 CHtggView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CHtggView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CHtggView message handlers

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

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

void CHtggView::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(340*x,440*y,PrintID);
	pDC->TextOut(1200*x,440*y,sHTBH);
	pDC->TextOut(430*x,550*y,sXMMC);

	rect=CRect(250*x,710*y,xPix-(250*x),1590*y );
	pDC->DrawText(sGGNR,&rect,DT_WORDBREAK);
	pDC->TextOut(480*x,1760*y,sHTQSR);
	pDC->TextOut(1360*x,1760*y,sHTGGQSR);
	pDC->TextOut(430*x,1860*y,sZBBM);
	pDC->TextOut(1250*x,1860*y,sXMZG);
	pDC->TextOut(430*x,1980*y,sCSRQ);
	pDC->TextOut(1250*x,1980*y,sHTGGSXRQ);
	rect=CRect(250*x,2180*y,xPix-(250*x),2680*y );
	pDC->DrawText(sBZ,&rect,DT_WORDBREAK);

}

⌨️ 快捷键说明

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