Delphi开发人员指南(第二部分·四)

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

10Delphi5•TPrinter•TPrinter.Canva•••••WindowsDelphiQReportQusoftQUICKRPT.hipQusoftQuickReportDelphiDelphiTPrinterWindowsTPrinter10.1TPrinterTPrinterWindowsTPrinterPrinter()10-110-2TPrinter10-1TPrinterAbortedCanvasFontsHandleOrientation(poLandScape)(poPortrait)PageHeight()PageNumberTPrinter.NewPage()PageWidth()PrinterIndex()PrintersPrintingTitle10-2TPrinterAbortBeginDocEndDoc(EndDocAbort)GetPrinterNewPagePageCount1SetPrinter10.2TPrinter.CanvasTPrinter.CanvasTPrinter.CanvasTPrinter.CanvasWindowsWindowsNT/2000Windows95/98300300640480300dpi11inch10.3Delphi10.3.1TMemoAssignPrn()AssignPrn()Rewrite()CloseFile()10Delphi5267varf:TextFile;beginAssignPrn(f);tryRewrite(f);Writeln(f,Printtheoutput);finallyCloseFile(f);end;end;Writeln(f,'Thisismylineoftext');16MDI10-1TMdiEditForm10-1TMdiEditFormTMemomemMainMemo10.3.216MDIMdiAppTMdiBmpForm10-226810-2TMdiBmpFormTCanvas.StretchDraw()Delphi3DIBDIBDIBTBitmapTBitmap.HandleTypebmDIBDIBDIB33inch640480300dpiStretchDIBits()TPrinter.Canvas8GDIWin32APIGetDeviceCaps()10.3.3RTFRTF16MDIprocedureTMdiRtfForm.mmiPrintClick(Sender:TObject);begininherited;reMain.Print(Caption);end;10.4TFormPrint()ProcedureTForm1.PrintMyForm(Sender:TObject);beginPrint;end;Windows10Delphi526910.5CD10.5.1Delphidemo10-1TEditTUpDown0.1inchedtHeaderFont10-110-3mmiPrintClick()1)2)3)4)5)2346)10-327010Delphi527127210Delphi5273mmiPrintClick()TStringListPixels-PerInchXTenthsOfInchPixelsY0.1inchAmountPrintedAmountPrintedPrinter.PageHeightedtHeaderFont.TextPrintHeader()PrintColumnNames()()tblClientwhile(nottblClients.Eof)orPrinter.AborteddobeginAddObject()TStringList(Items.Objects)ItemsPrintLine()Printer.AbortedTStringsTStringListObjectsAddObject()InsertObject()MaxLongIntAddObject()TObjectMyList.AddObject('SomeString',pointer(SomeInteger));LongintMyInteger:=Longint(MyList.Objects[Index]);ifAmountPrinted+LineHeightPrinter.PageHeightthenAmountPrinted0Printer.NewPage()tblClientsPrinter.EndDocPrintHeader()edtHeaderFont.TextdtHeaderFont.FontAmountPrintedPrintColumnNames()ColNamesTStr-274ingListPrintLine()Printer.Canvas.FontPrintLine()TStringList.ItemsItemsOutRectItems.Object[i]1/10inchItems.Object[i]0.1OutRect.RightXOutRectAmountPrintedLineHeight+TenthsOfInchPixelsY10.5.2TPrinter.Abort()Aborted10-3•Printer.Abort()•TextOut()NewPage()EndDoc()Printer.Abort•Printer.AbortTrueOnClickPrinter.Ablort()MainForm.pasTPrinter.BeginDoc()Printer.BeginDoc();AbortForm.Show;Application.ProcessMessages;AbortFormApplication.ProcessMessages()AbortFormTPrinterPrinter.AbortedAbortedAbort()TruePrinter.TextRectAbortedTrueifnotPrinter.AbortedthenTextRect(OutRect,OutRectLeft,OoutRect.Top,Item[i]);Abort()EndDoc()TPinter.CanvasWhilenotTable.EofPrinter.AbortedTrueTrue10.5.3writerln()Windows()10Delphi527510.5.410-2ABC()AXY10-310-4BC90˚A25503300B6.53.75inchC10-510-5A300dpi(300dpi8.511inch25503300)BC27610-210-3ABC10-4BCABACBCA2550BCTImageWindows1.1)2)3)4)5)6)ObjectPascalTPoint7)6ObjectPascalTRect8)5682.10inch6.75inchtypeTEnvelope=recordKind:string;//Width:double;//Height:double;//end;const//EnvArray:array[1..2]ofTEnvelope=((Kind:Size10;Width:9.5;Height:4.125),(Kind:Size6-3/4;Width:6.5;Height:3.625));2345Win32APIGetDeviceCaps()PixPerInX=GetDeviceCaps(Printer.Handle,LOGPIXELSX);PixPerInY=GetDeviceCaps(Printer.Handle,LOGPIXELSY);10Delphi5277PixPerInXPixPerInYEvelopeWindthInPixels:=trunc(EvelopeWidthValue*PixPerInX)EvelopeHeightInPixels:=trunc(EvelopeHeightValue*PixPerInX)trun()6710-610-410-610-427810Delphi527928010Delphi528128210Delphi5283284gbEvelopeSizegbFeedTypeFeedTypeClick()(TEdit)mmiPrintItClick()FormCreate()TFeedTypeTFeedType:=(epLHorz,epLVert,epRHorz,epRVect);TMainFormTFeedType67TMainFormGetEvelopeSize()GetEvelopePos()GetToAddrSize()GetToAddrPos()GetEvelopeSize()gbEvelopeSizeGetReviceCap()GetEvelopePos()GetToAddrSize()TextHeight()TextWidth()MaxLn()Math.pasMax()GetToAddrPos()GetToAddrSize()mmiPrintItClick()BeginDoc()TFeedTypeRotatePrintFont()90˚RotatePrintFont()TFecdTypeTextout()mmiPrintItClick()EndDoc()RotatePrintFont()TLogFontTLogFontifEscaperent8GDIlfEscapement0.1˚lpEscapement90090˚TrueTyupe10.5.5TPanelCanvasTPrintPrevPanel=Class(TPanel)publicPropertyCanvas;end;FormCreate()TPrintPrevPanelRatio:=Printer.PageHeight/Printer.PageWidth;TPrintPrevPanelTPanelTPrintPrevPanelPrintPrev10Delphi5285DrawIt()TEnvPrintForm.DrawIt()PrintPrev.Invalidate()PrintPrev.Update()MM_ISOTROPICXYSetWindowExt()SetViewPortExt()PrintPrevPrintPrev(8GDI)DrawIt()10-710-710.6TPrinterWin32APITDeviceMode10.6.1TDeviceModeTDeviceModeWindows.pasDelphiTDeviceModeWindowsNT/2000Window95/98TDeviceModeTPrinter.GetPrinter()GlobalLock()10-5TDeviceMode10-5TDeviceMode286TDeviceMode{CodetousetheDevModestructuregoeshere}{!!!!}dmFieldsTDeviceMode10-3dmFields10-3TDeviceMode.dmFieldsDM_ORIENTATIONdmOrientationDM_PAPERSIZEdmPaperSizeDM_PAPERLENGTHdmPaperLengthDM_PAPERWIDTHdmPaperWidthDM_SCALEdmScaleDM_COPIESdmCopiesDM_DEFAULTSOURCEdmDefaultSourceDM_PRINTQUALITYdmPrintQualityDM_COLORdmColorDM_DUPLEXdmDuplexDM_YRESOLUTIONdmYResolutionDM_TTOPTIONdmTTOptionDM_COLLATEdmCollateDM_FORMNAMEdmFormNameDM_LOGPIXE

1 / 24
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功