C源码Part II.docx

上传人:b****7 文档编号:25235682 上传时间:2023-06-06 格式:DOCX 页数:20 大小:18.06KB
下载 相关 举报
C源码Part II.docx_第1页
第1页 / 共20页
C源码Part II.docx_第2页
第2页 / 共20页
C源码Part II.docx_第3页
第3页 / 共20页
C源码Part II.docx_第4页
第4页 / 共20页
C源码Part II.docx_第5页
第5页 / 共20页
点击查看更多>>
下载资源
资源描述

C源码Part II.docx

《C源码Part II.docx》由会员分享,可在线阅读,更多相关《C源码Part II.docx(20页珍藏版)》请在冰豆网上搜索。

C源码Part II.docx

C源码PartII

C源码=>PartThree

#if!

defined(AFX_GlArtVCTITLE_GlArtH_GlArt_GlArtE6D979EA_GlArt1ED4_GlArt46E2_GlArtAE78_GlArt83FA81D4A520_GlArt_GlArtINCLUDED_GlArt)

#defineAFX_GlArtVCTITLE_GlArtH_GlArt_GlArtE6D979EA_GlArt1ED4_GlArt46E2_GlArtAE78_GlArt83FA81D4A520_GlArt_GlArtINCLUDED_GlArt

#if_GlArtMSC_GlArtVER>1000

#pragmaonce

#endif_GlArtMSC_GlArtVER>1000

MachinegeneratedIDispatchwrapperclass(es)createdbyMicrosoftVisualC++

NOTE:

Donotmodifythecontentsofthisfile.Ifthisclassisregeneratedby

MicrosoftVisualC++,yourmodificationswillbeoverwritten.

Dispatchinterfacesreferencedbythisinterface

classCVcTextLayout;

classCVcLocation;

classCVcBackdrop;

classCVcFont;

classCOleFont;

CVcTitlewrapperclass

classCVcTitle:

publicCOleDispatchDriver

{

public:

_GlArtCVcTitle(){}_GlArt_GlArtCallsCOleDispatchDriverdefaultconstructor

_GlArtCVcTitle(LPDISPATCHpDispatch):

COleDispatchDriver(pDispatch){}

_GlArtCVcTitle(constCVcTitle&dispatchSrc):

COleDispatchDriver(dispatchSrc){}

Attributes

public:

Operations

public:

_GlArtCVcTextLayoutGetTextLayout();

_GlArtCStringGetText();

_GlArtvoidSetText(LPCTSTRlpszNewValue);

_GlArtCVcLocationGetLocation();

_GlArtCVcBackdropGetBackdrop();

_GlArtCVcFontGetVtFont();

_GlArtshortGetTextLength();

_GlArtvoidSetRefFont(LPDISPATCHnewValue);

_GlArtCOleFontGetFont();

_GlArtvoidSelect();

};

{{AFX_GlArtINSERT_GlArtLOCATION}}

MicrosoftVisualC++willinsertadditionaldeclarationsimmediatelybeforethepreviousline.

#endif!

defined(AFX_GlArtVCTITLE_GlArtH_GlArt_GlArtE6D979EA_GlArt1ED4_GlArt46E2_GlArtAE78_GlArt83FA81D4A520_GlArt_GlArtINCLUDED_GlArt)

C源码=>PartFour

htglxtView.cpp:

implementationoftheCHtglxtViewclass

#include"stdafx.h"

#include"MyProject.h"

#include"MyDoc.h"

#include"MyView.h"

#ifdef_GlArtDEBUG

#definenewDEBUG_GlArtNEW

#undefTHIS_GlArtFILE

staticcharTHIS_GlArtFILE[]=_GlArt_GlArtFILE_GlArt_GlArt;

#endif

CHtglxtView

IMPLEMENT_GlArtDYNCREATE(CMyView,CScrollView)

BEGIN_GlArtMESSAGE_GlArtMAP(CMyView,CScrollView)

_GlArt{{AFX_GlArtMSG_GlArtMAP(CHtglxtView)

_GlArt_GlArtNOTE-theClassWizardwilladdandremovemappingmacroshere.

_GlArt_GlArtDONOTEDITwhatyouseeintheseblocksofgeneratedcode!

_GlArt}}AFX_GlArtMSG_GlArtMAP

_GlArtStandardprintingcommands

_GlArtON_GlArtCOMMAND(ID_GlArtFILE_GlArtPRINT,CScrollView:

:

OnFilePrint)

_GlArtON_GlArtCOMMAND(ID_GlArtFILE_GlArtPRINT_GlArtDIRECT,CScrollView:

:

OnFilePrint)

_GlArtON_GlArtCOMMAND(ID_GlArtFILE_GlArtPRINT_GlArtPREVIEW,CScrollView:

:

OnFilePrintPreview)

END_GlArtMESSAGE_GlArtMAP()

CHtglxtViewconstructiondestruction

CMyView:

:

CMyView()

{

_GlArtTODO:

addconstructioncodehere

_GlArtm_GlArtpos.cx=0;

_GlArtm_GlArtpos.cy=0;

_GlArtPageRow[1]=0;

}_GlArt

CMyView:

:

~CMyView()

{

_GlArtDeffont.DeleteObject();

}

BOOLCMyView:

:

PreCreateWindow(CREATESTRUCT&cs)

{

_GlArtTODO:

ModifytheWindowclassorstylesherebymodifying

_GlArttheCREATESTRUCTcs

_GlArtreturnCScrollView:

:

PreCreateWindow(cs);

}

CHtglxtViewdrawing

voidCMyView:

:

OnDraw(CDCpDC)

{

_GlArtCMyDocpDoc=GetDocument();

_GlArtASSERT_GlArtVALID(pDoc);

_GlArt逻辑设备大小

_GlArtLogicSize.cx=pDC->GetDeviceCaps(HORZRES);

_GlArtLogicSize.cy=pDC->GetDeviceCaps(VERTRES);

_GlArt画主标题

_GlArtPrintMainCaption(pDC,false);

_GlArt画副标题

_GlArtPrintDeckCaption(pDC,false);

_GlArt画表头

_GlArtLVCOLUMNcol;

_GlArtCStringstext;

_GlArtintwid,xpos,ypos;

_GlArtxpos=30;

_GlArtypos=m_GlArtpos.cy;

_GlArtpDC->Rectangle(30,ypos,LogicSize.cx-30,ypos+1);

_GlArtypos=ypos+10;

_GlArtintmm=m_GlArtps.Grid->GetCols();

_GlArtfor(inti=0;iGetCols();i++)

_GlArt{

_GlArt_GlArtcol.mask=LVCF_GlArtTEXT;

_GlArt_GlArtcol.pszText=stext.GetBuffer(stext.GetLength());

_GlArt_GlArtcol.cchTextMax=255;

_GlArt_GlArtm_GlArtps.Grid->GetColumn(i,&col);

_GlArt_GlArtwid=m_GlArtps.Grid->GetColumnWidth(i);

_GlArt_GlArtpDC->TextOut(xpos,ypos,col.pszText);

_GlArt_GlArtxpos=xpos+wid;

_GlArt}

_GlArtypos=ypos+20;m_GlArtpos向下移动一个字的宽度

_GlArtpDC->Rectangle(30,ypos,LogicSize.cx-30,ypos+1);

_GlArt画表格内容

_GlArtypos=ypos+10;

_GlArtxpos=30;

_GlArtfor(intr=0;rGetRows();r++)

_GlArt{

_GlArt_GlArtfor(intc=0;cGetCols();c++)

_GlArt_GlArt{

_GlArt_GlArt_GlArtstext=m_GlArtps.Grid->GetItemText(r,c);

_GlArt_GlArt_GlArtwid=m_GlArtps.Grid->GetColumnWidth(c);

_GlArt_GlArt_GlArtpDC->TextOut(xpos,ypos,stext);

_GlArt_GlArt_GlArtxpos=xpos+wid;

_GlArt_GlArt}

_GlArt_GlArtxpos=30;

_GlArt_GlArtypos=ypos+20;

_GlArt_GlArtm_GlArtpos.cx=30;

_GlArt_GlArtm_GlArtpos.cy=ypos;

_GlArt}

_GlArt打印合计信息

_GlArtpDC->Rectangle(30,ypos,LogicSize.cx-30,ypos+1);

_GlArtPrintTotal(pDC,false);

_GlArtTODO:

adddrawcodefornativedatahere

}

voidCMyView:

:

OnInitialUpdate()

{

_GlArtCScrollView:

:

OnInitialUpdate();

_GlArtCSizesizeTotal;

_GlArtTODO:

calculatethetotalsizeofthisview

_GlArtCDCpDC;

_GlArtpDC=this->GetDC();

_GlArt逻辑设备大小

_GlArtLogicSize.cx=pDC->GetDeviceCaps(HORZRES);

_GlArtLogicSize.cy=pDC->GetDeviceCaps(VERTRES);

_GlArtsizeTotal.cx=100;

_GlArtGridWidth=0;

_GlArtfor(inti=0;iGetCols();i++)

_GlArt{

_GlArt_GlArtGridWidth=GridWidth+m_GlArtps.Grid->GetColumnWidth(i);_GlArt

_GlArt}

_GlArtsizeTotal.cy=m_GlArtps.Grid->GetRows()24+200;

_GlArtsizeTotal.cx=GridWidth;

_GlArtSetScrollSizes(MM_GlArtTEXT,sizeTotal);

}

CHtglxtViewprinting

BOOLCMyView:

:

OnPreparePrinting(CPrintInfopInfo)

{

_GlArt宽度比率

_GlArtm_GlArtInfo=pInfo;

_GlArtreturnDoPreparePrinting(pInfo);

}

voidCMyView:

:

OnBeginPrinting(CDCpDC,CPrintInfopInfo)

{

_GlArtLPDEVMODEmode;

_GlArtmode=pInfo->m_GlArtpPD->GetDevMode();

_GlArt打印纸大小

_GlArtPageSize.cx=mode->dmPaperLength;

_GlArtPageSize.cy=mode->dmPaperWidth;

_GlArt逻辑设备大小

_GlArtLogicSize.cx=pDC->GetDeviceCaps(HORZRES);

_GlArtLogicSize.cy=pDC->GetDeviceCaps(VERTRES);

_GlArt比率

_GlArtRatio.x=(float)LogicSize.cx(float)PageSize.cx;

_GlArtRatio.y=(float)LogicSize.cy(float)PageSize.cy;

_GlArt打印页数

_GlArtpInfo->SetMaxPage(GridWidth20Ratio.xLogicSize.cx-1);

_GlArtDeffont.CreatePointFont(280Ratio.x,"宋体",NULL);

}

voidCMyView:

:

OnEndPrinting(CDCpDC,CPrintInfopInfo)

{

_GlArtTODO:

addcleanupafterprinting

}

CHtglxtViewdiagnostics

#ifdef_GlArtDEBUG

voidCMyView:

:

AssertValid()const

{

_GlArtCScrollView:

:

AssertValid();

}

voidCMyView:

:

Dump(CDumpContext&dc)const

{

_GlArtCScrollView:

:

Dump(dc);

}

CMyDocCMyView:

:

GetDocument()non-debugversionisinline

{

_GlArtASSERT(m_GlArtpDocument->IsKindOf(RUNTIME_GlArtCLASS(CMyDoc)));

_GlArtreturn(CMyDoc)m_GlArtpDocument;

}

#endif_GlArtDEBUG

CHtglxtViewmessagehandlers

voidCMyView:

:

OnPrint(CDCpDC,CPrintInfopInfo)

{

_GlArt逻辑设备大小

_GlArtLogicSize.cx=pDC->GetDeviceCaps(HORZRES);

_GlArtLogicSize.cy=pDC->GetDeviceCaps(VERTRES);

_GlArt宽度比率

_GlArtWidthRatio=LogicSize.cxGridWidth;

_GlArt画边框

_GlArtpDC->Rectangle(10Ratio.x,10Ratio.y,LogicSize.cx-(10Ratio.x),LogicSize.cy-(10Ratio.y));

_GlArtif(pInfo->m_GlArtnCurPage==1)

_GlArt{

_GlArt_GlArt画主标题

_GlArt_GlArtPrintMainCaption(pDC);

_GlArt_GlArt画副标题

_GlArt_GlArtPrintDeckCaption(pDC);

_GlArt_GlArt画表头

_GlArt_GlArtPrintGridHead(pDC);

_GlArt_GlArt画表格

_GlArt_GlArtPrintGridCell(pDC,pInfo);

_GlArt}

_GlArtelse

_GlArt{_GlArt

_GlArt_GlArt画表头

_GlArt_GlArtPrintGridHead(pDC);

_GlArt_GlArtPrintGridCell(pDC,pInfo);

_GlArt}

_GlArtPrintPage(pDC,pInfo);

_GlArtCScrollView:

:

OnPrint(pDC,pInfo);

}

voidCMyView:

:

PrintMainCaption(CDCpDC,boolbRatio)

{_GlArt

_GlArt是否自动根据分辨率调整位置

_GlArtRatioStructrRatio;

_GlArtrRatio.x=0.5;

_GlArtrRatio.y=0.5;

_GlArtif(bRatio==true)

_GlArt_GlArtrRatio=Ratio;

_GlArt逻辑设备大小

_GlArtLogicSize.cx=pDC->GetDeviceCaps(HORZRES);

_GlArtLogicSize.cy=pDC->GetDeviceCaps(VERTRES);

_GlArtCFontMainfont;

_GlArtMainfont.CreatePointFont(m_GlArtps.MainCaptionFontSizerRatio.y,"黑体",NULL);

_GlArtpDC->SelectObject(&Mainfont);

_GlArtCRectrect(10rRatio.x,10rRatio.y,LogicSize.cx-(10rRatio.x),m_GlArtps.MainCaptionFontSize4rRatio.y+(10rRatio.y));

_GlArtpDC->DrawText(m_GlArtps.MainCaption,&rect,DT_GlArtCENTER|DT_GlArtVCENTER|DT_GlArtSINGLELINE);

_GlArtm_GlArtpos.cy=m_GlArtps.MainCaptionFontSize4rRatio.y+(10rRatio.y);

_GlArtMainfont.DeleteObject();

}

voidCMyView:

:

PrintDeckCaption(CDCpDC,boolbRatio)

{

_GlArt是否自动根据分辨率调整位置

_GlArtRatioStructrRatio;

_GlArtrRatio.x=0.5;

_GlArtrRatio.y=0.5;

_GlArtif(bRatio==true)

_GlArt_GlArtrRatio=Ratio;

_GlArt逻辑设备大小

_GlArtLogicSize.cx=pDC->GetDeviceCaps(HORZRES);

_GlArtLogicSize.cy=pDC->GetDeviceCaps(VERTRES);

_GlArtCFontDeckfont;

_GlArtDeckfont.CreatePointFont(m_GlArtps.DeckCaptionFontSizerRatio.y,"宋体",NULL);

_GlArtpDC->SelectObject(&Deckfont);

_GlArtCRectrect;

_GlArtfor(inti=0;i

_GlArt{

_GlArt_GlArtm_GlArtpos.cy=m_GlArtpos.cy+(m_GlArtps.DeckCaptionFontSize5)rRatio.y;

_GlArt_GlArtpDC->TextOut(50rRatio.x,m_GlArtpos.cy,m_GlArtps.DeckCaptions[i]);

_GlArt}

_GlArtm_GlArtpos.cy=m_GlArtpos.cy+(m_GlArtps.DeckCaptionFontSize5)rRatio.y;

_GlArtDeckfont.DeleteObject();

}

voidCMyView:

:

PrintGridHead(CDCpDC,boolbRatio)

{

_GlArt是否自动根据分辨率调整位置

_GlArtRatioStructrRatio;

_GlArtrRatio.x=0.5;

_GlArtrRatio.y=0.5;

_GlArtif(bRatio==true)

_GlArt_GlArtrRatio=Ratio;

_GlArtpDC->SelectObject(&Deffont);

_GlArt逻辑设备大小

_GlArtLogicSize.cx=pDC->GetDeviceCaps(HORZRES);

_GlArtLogicSize.cy=pDC->GetDeviceCaps(VERTRES);

_GlArt画线

_GlArtpDC->Rectangle(50rRatio.x,m_GlArtpos.cy,LogicSize.cx-(50rRatio.x),m_GlArtpos.cy+2rRatio.y);

_GlArt画表头

_GlArtLVCOLUMNcol;

_GlArtCStringstext;

_GlArtm_GlArtpos.cx=50rRatio.x;

_GlArtintwid;

_GlArtm_GlArtpos.cy=m_GlArtpos.cy+10rRatio.y;

_GlArtfor(inti=0;iGetCols();i++)

_GlArt{

_GlArt_GlArtcol.mask=LVCF_GlArtTEXT;

_GlArt_GlArtcol.pszText=stext.GetBuffer(stext.GetLength());

_GlArt_GlArtcol.cchTextMax=255;

_GlArt_GlArtm_GlArtps.Grid->GetColumn(i,&col);

_GlArt_GlArtwid=m_GlArtps.Grid->GetColumnWid

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 表格模板 > 书信模板

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1