亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? easyreport.cpp

?? 串口編程 與單片機通訊的 其中有的地方需修改 僅供學習 請未公司使用
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
/*******************************************************************************
 * EasyReport.cpp: implementation of the CEasyReport class.
 *
 * MFC Easy! Report class
 *
 * Written by Vipul Lal <VipulLal@hotmail.com> or <vipul@del2.vsnl.net.in>
 * Copyright (c) 2000-2002. All Rights Reserved.
 *
 * This code may be used in compiled form in any way you desire. This
 * file may be redistributed unmodified by any means PROVIDING it is 
 * not sold for profit without the authors written consent, and 
 * providing that this notice and the authors name and all copyright 
 * notices remains intact. 
 *
 * An email letting me know how you are using it would be nice. 
 *
 * This file is provided "as is" with no expressed or implied warranty.
 * The author accepts no liability for any damage/loss of business that
 * this product may cause.
 *
 * Description:
 * This class encapsulates the functionality required for most reports. 
 * We could have derived this class from CDocument, but that would not 
 * have been as flexible as a stand alone class. 
 *
 *
 *
 *******************************************************************************/

#include "stdafx.h"
#include "EasyReport.h"
#include "RepElement.h"

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


IMPLEMENT_SERIAL(CEasyReport, CObject,1);

void	CEasyReport::Serialize(CArchive & inAr)
{
	// no serialize yet !
}


/*****************************************************************
 * 
 * method :CEasyReport::CEasyReport()
 *
 * parameters : None
 *
 * returns : Nothing
 *
 * description: Constructor. Set up page sizes, initalize pointers
 * to null etc.
 *
 ****************************************************************/
CEasyReport::CEasyReport()
{
	int		i;
	for(i=0;i < eMaxStyles ;i++)
	{
		m_Fonts[i]= NULL;
	}
	
	// print device context...
	m_PrinterDC = NULL;
	
	// No data columns as yet..
	m_NumDataCols = 0;
	m_DataCols = NULL;
	
	
	// setup page defaults. Note: The report used the LO_METRIC
	// unit of measurement. Thus, 1 inch = 2.54 cms = 25.4 mm =
	// 254 LO_METRIC units.
	m_PageHeight = 11 * 254;	// height of the entire page
	m_PageWidth = (int)(8.5 * 254);
	m_TopMargin = 127;		// Half inch margin all around
	m_BottomMargin = 127;
	m_LeftMargin = 127;
	m_RightMargin = 127;
	
	// headers and footers. By default, ReportHeader and ReportFooter
	// are set to .5". The default report header consists of the 
	// company name centered on the page. The default page header
	// contains the report name and the date. The default page
	// footer contains the page number centered within the margins.
	// These are defaults. You can override these in derived classes
	// or set these directly. For instance, to customize the default 
	// report header, override the WriteReportHeader() virtual. Ditto 
	// for other headers and footers.
	m_PageHdrHt = 100;		// height of the page header is 1cm
	m_PageFtrHt = 100;		// height of the page footer is 1cm
	m_CurPage = m_PageCount = 0;
	
	// The m_SuppressBlankTbl, if true, will suppress a table header from 
	// appearing on the report unless something is written to one of the 
	// columns. The RepeatTblHdr flag forces the system to repeat the 
	// column headings on every page.
	m_SuppressBlankTbl = true;	// do not write the column headings if no data is written to the column
	m_RepeatTblHdr = false;		// do not repeat column headings on every page
	
	// Default report heading contains the company name
	m_CompanyName = "Power Play Software";	// replace with your company name !
	m_ReportHdrHt = 200;	// 2 cm high
	m_ReportFtrHt = 0;		// no report footer
	
	m_StdPen.CreatePen(PS_SOLID,2, RGB(0,0,0));
	
}

/*****************************************************************
 * 
 * method :void	CEasyReport::SetupTextStyles(CDC *inDC)
 *
 * parameters : inDC: Handle to the printer device context
 *
 * returns : Nothing.
 *
 * description: Set up the fonts required for the report. This is a
 * virtual function, so if you override in derived classes, you can 
 * modify the default fonts. Actually, it might have been better if
 * we had individual virtual functions, like "CreateHeadingFont" etc
 * which would enable the user to override individual font styles
 * per report. Maybe we can implement this in a later version!
 *
 * The Caption font is used for the report title.
 * The ColHeading font is used for column headings.
 * The DataFont is used for the data in columns
 * The TextFont is used for paragraphs of text.
 *
 ****************************************************************/
void	CEasyReport::SetupTextStyles(HDC  inDC)
{
	// create default fonts...
	LOGFONT			aFont;
	CPoint			aPoint;
	
	// The caption font is 30 point bold, italics
	aPoint.y = (10 * GetDeviceCaps(inDC, LOGPIXELSY))/72;
//	DPtoLP(inDC, &aPoint,1);
	memset(&aFont,0,sizeof(aFont));
//	aFont.lfHeight = aPoint.y;
	aFont.lfHeight = 100;
	aFont.lfWeight = FW_BOLD;
	aFont.lfItalic = 1;
//	aFont.lfOutPrecision = OUT_STROKE_PRECIS; // Truetype font
//	aFont.lfQuality = PROOF_QUALITY;
//	aFont.lfPitchAndFamily = FF_ROMAN | VARIABLE_PITCH;
	strcpy(aFont.lfFaceName,"宋體");
	m_Fonts[ eCaptionFont ] = new CFont();
	m_Fonts[ eCaptionFont ]->CreateFontIndirect(&aFont);

	// the column heading font is 20-point bold, italic
//	aPoint.y = (20 * GetDeviceCaps(inDC,LOGPIXELSY))/72;
//	DPtoLP(inDC,&aPoint,1);
	memset(&aFont,0,sizeof(aFont));
	aFont.lfHeight = 80;
	aFont.lfItalic = 1;
	aFont.lfWeight = FW_BOLD;
	aFont.lfOutPrecision = OUT_TT_PRECIS ; // Truetype font
	aFont.lfQuality = PROOF_QUALITY;
	aFont.lfPitchAndFamily = FF_SWISS | VARIABLE_PITCH;
	strcpy(aFont.lfFaceName,"黑體");
	m_Fonts[ eColHeadingFont ] = new CFont();
	m_Fonts[ eColHeadingFont ]->CreateFontIndirect(&aFont);

	// the data font is 20 point regular
//	aPoint.y = (16 * GetDeviceCaps(inDC,LOGPIXELSY))/72;
//	::DPtoLP(inDC,&aPoint,1);
	memset(&aFont,0,sizeof(aFont));

	aFont.lfHeight = 60;

	aFont.lfWeight = FW_REGULAR;
	aFont.lfOutPrecision = OUT_TT_PRECIS; // Truetype font
	aFont.lfQuality = PROOF_QUALITY;
	aFont.lfPitchAndFamily = FF_ROMAN | FIXED_PITCH;
	strcpy(aFont.lfFaceName,"宋體");
	m_Fonts[ eDataFont ] = new CFont();
	m_Fonts[ eDataFont ]->CreateFontIndirect(&aFont);

	// the text font is ansi variable font
	m_Fonts[ eTextFont ] = new CFont();
	m_Fonts[ eTextFont ]->CreateStockObject(ANSI_VAR_FONT);
	
	// determine the cell sizes for the fonts...
	TEXTMETRIC		aTM;

	SelectObject(inDC,(HFONT)m_Fonts[eCaptionFont]);
	GetTextMetrics( inDC, &aTM );
	m_TextSizes[ eCaptionFont].cx = aTM.tmAveCharWidth;
	m_TextSizes[ eCaptionFont].cy = 100;

	SelectObject(inDC,(HFONT)m_Fonts[eColHeadingFont]);
	GetTextMetrics( inDC, &aTM );
	m_TextSizes[ eColHeadingFont].cx = aTM.tmAveCharWidth;
	m_TextSizes[ eColHeadingFont].cy = 80;

	SelectObject(inDC,(HFONT)m_Fonts[eDataFont]);
	GetTextMetrics(inDC,&aTM );
	m_TextSizes[ eDataFont].cx = aTM.tmAveCharWidth;
	m_TextSizes[ eDataFont].cy = 60;

	SelectObject(inDC,(HFONT)m_Fonts[eTextFont]);
	GetTextMetrics(inDC,&aTM );
	m_TextSizes[ eTextFont].cx = aTM.tmAveCharWidth;
	m_TextSizes[ eTextFont].cy = aTM.tmHeight+ aTM.tmExternalLeading;
	m_BreakChar = aTM.tmBreakChar;
}


/*****************************************************************
 * 
 * method :CEasyReport::~CEasyReport()
 *
 * parameters : 
 *
 * returns : 
 *
 * description: Destructor. Clean up the resources we allocated.
 *
 ****************************************************************/
CEasyReport::~CEasyReport()
{
	DoCleanup();
}


/*****************************************************************
 * 
 * method :void	CEasyReport::DoCleanup()
 *
 * parameters : 
 *
 * returns : 
 *
 * description: Clean up all the resources we allocated
 *
 *
 ****************************************************************/
void	CEasyReport::DoCleanup()
{
	int			i;
	CElement	*aElem;

	for(i=0; i<	m_ReportItems.GetSize();i++)
	{
		aElem = (CElement *) m_ReportItems[i];
		delete aElem;
	}
	m_ReportItems.RemoveAll();	// clear counts...

	for(i=0;i< eMaxStyles;i++)
	{
		delete m_Fonts[i];
		m_Fonts[i]=NULL;
	}
	m_PageItems.RemoveAll();
}


/*****************************************************************
 * 
 * method :void	SetupRectForCol(int inTabStop, CRect &outRect)
 *
 * parameters : 
 *
 * returns : 
 *
 * description: set up rectangle so that the printing can happen only 
 * within the tab stop and the next tab stop, or up the edge of the 
 * right margin
 *
 ****************************************************************/
void	CEasyReport::SetupRectForCol(int inTabStop, CRect &outRect)
{
	outRect.top = m_DataTop;
	outRect.bottom = outRect.top + m_TextSizes[eDataFont].cy;
	if( inTabStop <= 0 )
	{
		// rectangle extends from the left edge upto the first tab stop
		outRect.left = m_LeftMargin;
		outRect.right = m_TabStops[1];
		return;
	}
	// If inTab is after the last valid tab, trim it to be within the right margin.
	if( inTabStop > m_TabStops.GetSize()-1)
	{
		// inTabStop = m_TabStops.GetSize()-1;
		// set to the last tab
		outRect.left = m_TabStops[ m_TabStops.GetSize() - 2 ];
		outRect.right = m_PageWidth - m_RightMargin;
		return;
	}
	outRect.left = m_TabStops[inTabStop];
	outRect.right = m_TabStops[inTabStop+1];
}


/*****************************************************************
 * 
 * method :void		WriteParagraph(const char *inText)
 *
 * parameters : inText: Long text which may be word wrapped
 *
 * returns : nothing
 *
 * description: Write a paragraph of text. If the text extends 
 * beyond the right edge, the text is wrapped around. Note: This 
 * function is not called directly, but through AtTab with tabs
 * set to NULL.
 *
 ****************************************************************/
void	CEasyReport::WriteParagraph(const char *inText)
{
	int			aAbsBottom, aAbsWidth;
	int			aCurPos, aLen, aRight;
	char		aTempStr[128];	// non portable (should be TCHAR etc)!
	CRect		aRect;
	CSize		aSize;
	CTextBox	*aBox;
	
	aRect.left = m_LeftMargin;
	aRect.right = m_PageWidth - m_RightMargin;

	aAbsBottom = m_PageHeight - ( m_BottomMargin + m_PageFtrHt );
	aAbsWidth = m_PageWidth - ( m_LeftMargin + m_RightMargin);

	aLen = strlen(inText);
	aCurPos = 0;
	::SelectObject(m_PrinterDC,(HFONT)m_Fonts[eTextFont]);
	::SetTextCharacterExtra(m_PrinterDC,0);
	while(inText[aCurPos])
	{
		if( m_DataTop + m_TextSizes[eTextFont].cy > aAbsBottom )
		{
			EjectPage(false);
			aAbsBottom = m_PageHeight - ( m_BottomMargin + m_PageFtrHt );
		}

		// see if the remainder of the string will fit into the right margin
		::SetTextJustification(m_PrinterDC,0,0);
		::GetTextExtentExPoint(m_PrinterDC, inText + aCurPos, aLen - aCurPos, aAbsWidth, &aRight,NULL, &aSize);

		if( inText[aCurPos+aRight] != 0 )
		{
			while( inText [aCurPos + aRight ] != m_BreakChar )
			{
				--aRight;
				if( aRight <= 0 )
				{
					// Hopeless, the entire string is one big word !
					::GetTextExtentExPoint(m_PrinterDC, inText + aCurPos, aLen - aCurPos, aAbsWidth, &aRight,NULL, &aSize);
					--aRight;
					break;
				}
			}
		}

		ASSERT(aRight < sizeof(aTempStr));	// Warning ! this check is at compile time only !
		strncpy( aTempStr, inText + aCurPos, aRight);
		aTempStr[aRight] = 0;

		aRect.top = m_DataTop;
		aRect.bottom = aRect.top + m_TextSizes[eTextFont].cy;
		aBox = new CTextBox(&aRect, aTempStr, eTextFont);
		aBox->SetDocPtr( this );
		m_ReportItems.Add(aBox);
		if( inText[ aCurPos + aRight] == m_BreakChar)
			++aRight;
		aCurPos += aRight;
		m_DataTop += m_TextSizes[eTextFont].cy;
	}
}


/*****************************************************************
 * 
 * method :void	CEasyReport::AtTab(int inTabStop, const char *inText)
 *
 * parameters : inTabStop
 *				char *inText: text to display
 *
 * returns : nothing
 *
 * description: If a tabular section is in place (ie if m_NumDataCols
 * is non-zero, then we assume that this is a text area and we write
 * out a paragraph. If a tabular section is in place, we write the
 * data into the indicated column.
 *
 *
 ****************************************************************/
void	CEasyReport::AtTab(int inTabStop, const char *inText)
{
	CRect	aRect;

	if( m_NumDataCols == 0)
	{
		WriteParagraph(inText);
	}
	else
	{
		if( m_RedrawTblHdr )
		{
			if( m_DataTop + m_TableHeadingHt + GetDataFontSize().cy > (GetBottomEdge() - m_PageFtrHt) )
				EjectPage(false);
			if( !m_RepeatTblHdr )
				WriteTableHeader();
			m_RedrawTblHdr = false;
		}
		SetupRectForCol(inTabStop, aRect);

		CTextBox	*aBox = new CTextBox(&aRect,inText,eDataFont);
		aBox->SetDocPtr(this);

		ASSERT( inTabStop < m_NumDataCols);
		switch( m_DataCols[inTabStop].m_align)
		{
			case CColInfo::eLeft:
				aBox->SetAlign(DT_LEFT);
				break;
			case CColInfo::eDecimal:
			case CColInfo::eRight:

				// for fixed width fonts, if you control the format of data, then
				// simply aligning the text right aligns the decimal places. For 
				// propotional fonts, you will have to adjust the left edge of
				// the box.

				aBox->SetAlign(DT_RIGHT);
				break;
			case CColInfo::eCenter:
				aBox->SetAlign( DT_CENTER );
				break;
		}
		m_ReportItems.Add( aBox );
	}
}


/*****************************************************************
 * 
 * method :void	CEasyReport::SetDataCols(CColInfo  *inCols, int inColCount)
 *
 * parameters : inCols : Array of CColInfo structur
 *				inColCount: # of columns.
 *
 * returns : Nothing
 *
 * description: Use this function to start a new tabular section
 * on the report. If inCols == NULL (ie if the user wants a non tabular
 * section) the tab stops are set to every 8 characters and the word
 * wrap feature is enabled. 
 *
 * If inCols is not NULL, then the colum start positions are 
 * calculated based on the character counts of the column. 
 * 
 * The algorithm supports multiple row headings - simply put a
 * '\n' into the heading string. See example in SampleReportDoc.cpp
 *
 * Note: The colum width is in number of characters, which is easy,
 * since typically, a database column width is specified in # of 
 * characters. However, with True-type fonts and propotional spacing,
 * the display may be truncated. To eliminate this problem, you might
 * want to modify the code to either use MaxCharWidth for the font or
 * you might want to specify the column with in LogicalUnits. Since 
 * MM_LOMETRIC unit is used in the report, the column width would be 
 * the size in mm * 10.
 *
 ****************************************************************/
void	CEasyReport::SetDataCols(CEasyReport::CColInfo  *inCols, int inColCount)
{
	int			i, aLeft, aMax, aCharWidth;
	int			nRows,nMaxRows;
	const char	*s;
	CColInfo	*aCol;

	m_TabStops.RemoveAll();
	if( inCols == NULL || inColCount == 0)
	{
		aCharWidth = m_TextSizes[ eTextFont].cx;
		m_DataCols = NULL;
		m_NumDataCols = 0;
		m_TableHeadingHt = 0;

		// Set up tabs at every 8 characters...
		aMax = (m_PageWidth - m_RightMargin) / 8;
		for(i=0; i <= aMax; i++)
			m_TabStops.Add((WORD)(m_LeftMargin + i * 8 * aCharWidth) );
		return;
	}
	aCharWidth = m_TextSizes[ eDataFont].cx;
	m_DataCols = inCols;
	m_NumDataCols = inColCount;

	
	nRows = nMaxRows = 1;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人黄色网址在线观看| 日韩精品一二三| 福利一区福利二区| 久久久久9999亚洲精品| 国产不卡免费视频| 欧美国产精品一区二区三区| 成人国产一区二区三区精品| 亚洲色图视频网| 欧美偷拍一区二区| 麻豆91在线看| 国产亚洲欧洲一区高清在线观看| 国产成人精品免费在线| 亚洲欧美色一区| 91精品国产美女浴室洗澡无遮挡| 51精品久久久久久久蜜臀| 成人免费小视频| 在线观看区一区二| 日本三级亚洲精品| 久久久综合网站| 91伊人久久大香线蕉| 日韩高清在线一区| 欧美激情艳妇裸体舞| 欧美午夜电影网| 欧美日韩美女一区二区| 激情久久久久久久久久久久久久久久 | 国产成人午夜精品5599| 国产精品免费观看视频| 欧美日韩卡一卡二| 国产成人av自拍| 亚洲成人www| 久久久久久亚洲综合影院红桃| 91丝袜高跟美女视频| 蜜臀a∨国产成人精品| 国产精品久久久久久久久久久免费看| 在线视频一区二区三| 国产麻豆欧美日韩一区| 亚洲一区二区在线播放相泽| 国产欧美日韩精品一区| 欧美日韩国产中文| www.在线欧美| 国内精品伊人久久久久av影院| 一区二区高清视频在线观看| 国产亚洲一区字幕| 欧美一区二区三区的| 91成人网在线| 丁香婷婷综合网| 精品在线观看视频| 午夜精品影院在线观看| 最近中文字幕一区二区三区| 精品裸体舞一区二区三区| 欧美日韩aaa| 色偷偷成人一区二区三区91| 国产激情视频一区二区在线观看| 亚洲在线一区二区三区| 亚洲欧洲99久久| 中文字幕av一区二区三区高| 精品粉嫩超白一线天av| 欧美一级淫片007| 色视频一区二区| www.欧美日韩| 成人一道本在线| 国产成人精品亚洲午夜麻豆| 加勒比av一区二区| 久久99久久99小草精品免视看| 亚洲成人tv网| 日日欢夜夜爽一区| 婷婷成人综合网| 日本美女一区二区| 日韩成人一级片| 日本不卡一二三区黄网| 爽好多水快深点欧美视频| 亚洲成人精品在线观看| 亚洲成a人v欧美综合天堂下载| 亚洲男帅同性gay1069| 亚洲免费观看在线观看| 亚洲欧美日韩在线| 亚洲男人的天堂一区二区| 亚洲免费在线视频一区 二区| 国产精品电影院| 一区二区欧美精品| 午夜婷婷国产麻豆精品| 日韩高清在线观看| 精品系列免费在线观看| 欧美亚洲日本一区| 欧美日韩国产三级| 91麻豆精品国产91久久久久| 欧美一区二区三区的| 精品蜜桃在线看| 久久久久88色偷偷免费| 综合欧美亚洲日本| 一卡二卡三卡日韩欧美| 午夜久久久久久久久久一区二区| 日韩激情视频网站| 精品一区二区在线视频| 国产69精品久久99不卡| 色婷婷亚洲综合| 欧美妇女性影城| 精品成人佐山爱一区二区| 中文av一区特黄| 一区二区三区日韩精品视频| 丝袜脚交一区二区| 国产乱对白刺激视频不卡| 99re这里都是精品| 欧美日韩亚洲高清一区二区| 精品久久久久香蕉网| 国产精品欧美一区二区三区| 亚洲色大成网站www久久九九| 亚洲一区二区三区视频在线播放 | 蜜臀精品一区二区三区在线观看| 久久99久国产精品黄毛片色诱| 粉嫩在线一区二区三区视频| 色综合久久综合网97色综合 | 色婷婷久久久亚洲一区二区三区 | 精品国内片67194| 国产精品国产自产拍高清av| 亚洲国产精品麻豆| 国产乱子伦视频一区二区三区| 波多野结衣精品在线| 欧美男女性生活在线直播观看| 久久精品一级爱片| 亚洲国产精品天堂| 成人精品免费视频| 7777精品伊人久久久大香线蕉最新版| 久久蜜桃一区二区| 亚洲国产精品久久艾草纯爱| 国产伦精品一区二区三区视频青涩| 91丨porny丨国产入口| 日韩一区二区三区精品视频| 国产精品久久久久久久久免费桃花 | 久久99精品国产麻豆婷婷洗澡| av一本久道久久综合久久鬼色| 欧美久久久久久久久中文字幕| 国产精品二三区| 国内精品久久久久影院一蜜桃| 91福利视频在线| 国产精品婷婷午夜在线观看| 人人狠狠综合久久亚洲| 色婷婷综合久久久中文一区二区| 久久久无码精品亚洲日韩按摩| 亚洲国产精品自拍| av在线一区二区| 五月激情六月综合| 91久久精品一区二区| 国产精品区一区二区三| 狠狠狠色丁香婷婷综合久久五月| 欧美综合久久久| 亚洲欧美乱综合| av亚洲产国偷v产偷v自拍| 久久综合色鬼综合色| 蜜桃视频在线观看一区| 欧美午夜精品久久久久久孕妇| 亚洲人成精品久久久久久| 成人精品免费看| 久久品道一品道久久精品| 日韩主播视频在线| 5566中文字幕一区二区电影 | 国产精品色哟哟网站| 国产一区二区主播在线| 日韩欧美国产综合在线一区二区三区| 亚洲国产欧美日韩另类综合 | www.成人在线| 国产精品久久久久三级| 成人免费毛片a| 欧美国产日韩a欧美在线观看| 国内精品久久久久影院一蜜桃| 精品国产免费一区二区三区香蕉 | 久久精品国产一区二区三 | 国产精品一二三| 久久免费偷拍视频| 国产精品亚洲午夜一区二区三区 | 99热在这里有精品免费| 国产精品视频yy9299一区| 成人网在线播放| 中文字幕中文字幕一区| 91在线看国产| 亚洲综合色区另类av| 欧美亚洲免费在线一区| 日韩黄色在线观看| 日韩欧美综合在线| 国产一区二区三区综合| 国产精品久线观看视频| 色哟哟国产精品免费观看| 亚洲国产精品久久人人爱蜜臀| 欧美绝品在线观看成人午夜影视| 人妖欧美一区二区| 国产网站一区二区三区| av网站一区二区三区| 亚洲一区二区在线视频| 日韩一级在线观看| 国产一区二区不卡在线| 国产精品美女久久久久高潮| 色婷婷av一区二区三区大白胸| 午夜久久久久久久久久一区二区| 日韩久久精品一区| 不卡av在线网| 首页国产欧美日韩丝袜| 国产午夜久久久久| 在线观看成人免费视频| 免费美女久久99| 国产精品久久午夜夜伦鲁鲁|