请帮忙,给出代码?谢谢

解决方案 »

  1.   

    会不会跟priter.pageheiht=1820有关系,如何增加priter.pageheiht的值,比如使它等于无穷大,因为,我的要求是将数据库表的所有记录(如5000条记录)一次性打印出来,不换页。
    priter.pageheiht是只读属性
      

  2.   

    //设置纸张高度:单位--0.1mm
    procedure SetPaperHeight(H_Dot1mm: Integer);
    var
      Device: array[0..255] of Char;
      Driver: array[0..255] of Char;
      Port: array[0..255] of Char;
      hDMode: THandle;
      PDMode: PDEVMODE;
    begin
    //自定义纸张最小高度127mm
      if H_Dot1mm < 1270 then H_Dot1mm := 1270;
    //自定义纸张最大高度432mm
      if H_Dot1mm > 4320 then H_Dot1mm := 4320;
      Printer.PrinterIndex := Printer.PrinterIndex;
      Printer.GetPrinter(Device, Driver, Port, hDMode);
      if hDMode <> 0 then
      begin
        pDMode := GlobalLock(hDMode);
        if pDMode <> nil then
        begin
          pDMode^.dmFields := pDMode^.dmFields or DM_PAPERSIZE or DM_PAPERLENGTH;
          pDMode^.dmPaperSize := DMPAPER_USER;
          pDMode^.dmPaperLength := H_Dot1mm;
          pDMode^.dmFields := pDMode^.dmFields or DMBIN_MANUAL;
          pDMode^.dmDefaultSource := DMBIN_MANUAL;
          GlobalUnlock(hDMode);
        end;
      end;
      Printer.PrinterIndex := Printer.PrinterIndex;
    end;