如何在 Windows NT 和 Windows 2000 中使用自定义页面大小打印[5]

[入库:2006年2月23日] [更新:2007年3月24日]

本文简介:

d, Selection succeeded! End If End If End If ' Change the appropriate member in the DevMode. ' In this case, you want to change the form name. pDevMode.dmFormName = FormName & Chr(0) ' Must be NULL terminated! ' Set the dmFields bit flag to indicate what you are changing. pDevMode.dmFields = DM_FORMNAME ' Copy your changes back, then update DEVMODE. Call CopyMemory(aDevMode(1), pDevMode, Len(pDevMode)) nSize = DocumentProperties(MyhWnd, PrinterHandle, PrinterName, _ aDevMode(1), aDevMode(1), DM_IN_BUFFER Or DM_OUT_BUFFER) nSize = ResetDC(hPrtDC, aDevMode(1)) ' Reset the DEVMODE for the DC. ' Close the handle when you are finished with it. ClosePrinter (PrinterHandle) ' Selection Succeeded! But was Form Added? If SelectForm <> FORM_ADDED Then SelectForm = FORM_SELECTED Else SelectForm = FORM_NOT_SELECTED ' Selection Failed! End If End Function Public Sub PrintTest() ' Print two test pages to confirm the page size. Printer.Print "Top of Page 1." Printer.NewPage ' Spacing between lines should reflect the chosen page height. Printer.Print "Top of Page 2. - Check the page Height (Length.)" Printer.EndDoc MsgBox "Check Printer " & Printer.DeviceName, vbInformation, "Done!" End Sub 7.运行该工程。列表框中将显示当前打印机支持的所有页形。8.单击Command1。这将在该列表的末尾添加“MyCustomForm - 214 mm X 216 mm (xxx)”。其中,“xxx”是分配给这个新页形的编号。9.单击列表框中的一个页形,然后单击Command2。这将使用所选页形在当前打印机上打印一张测试页。10.单击列表框中的新自定义页形,然后单击Command3。程序将提示您是否确定要删除该页形。如果单击,程序将删除该自定义页形。如果尝试删除预定义的页形,将引发错误 87,因为只有自定义页形可以删除。

本文关键:如何在 Windows NT 和 Windows 2000 中使用自定义页面大小打印
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top