高分求助,300分拱手相送!!!在QuickReport中自定義紙張打印寬行紙!(100分)

W

wanby

Unregistered / Unconfirmed
GUEST, unregistred user!
在epson lq-1900k打印機中打印工資報表,紙張為355.5mm*279.4mm(用inch則為14*11)
我用QuickReport作報表,在quickrep中將紙張設為customer size:355.5*279.4mm
中預覽中沒問題,可是打印時卻只打印了寬約20cm的東西,縱向倒沒問題,無論在打印怎麼設都這樣
沒辦法,我只好在Quickrep的beforePrint事件中自定義紙張代碼如下:
procedure TrptGZBB.repGZBBeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
var
Device :array [0..(cchDeviceName-1) ] of Char;
Driver :array [0..(MAX_PATH-1)] of char ;
Port : array[0..32] of char ;
hDMode :THandle;
pDMode :pDevMode;
begin

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;
pDMode^.dmPaperSize:=dmPaper_user;
{ 設置為自定義紙的方式 0和256 }
pDMode^.dmFields:=pDMode^.dmFields or DM_PAPERLENGTH;
pDMode^.dmPaperLength:=2794;//長度
pDMode^.dmFields:=pDMode^.dmFields or DM_PAPERWIDTH;
pDMode^.dmPaperWidth:=3555;//寬度
// printer.SetPrinter(device,driver,port,hdmode);

pDMode^.dmFields := pDMode^.dmFields or DMBIN_MANUAL;
pDMode^.dmDefaultSource := DMBIN_MANUAL;

GlobalUnlock(hDMode);
Printer.PrinterIndex:=Printer.PrinterIndex;
end;

end;

end;

可還是老樣子,請教各位大蝦,問題出在哪里?誰能最先幫我解決此問題,500分拱手相送!!!
 
在控制面版里设置打印机属性,把自定义类型也设置为同样大小。
 
控制面板中打印機屬性中沒有這種紙張的類型,設為其它相近的也不行.
 
Win2000不支持自定义纸张,所以,没办法
 
打印机属性里不是有一种"自定义"类型吗?
设置它的大小就可以了.
 
win2000中打印機屬性沒有自定義這一項
 
我的计算机windows 2000 就有自定义纸张
这应该与不同种类的打印机的驱动程序有关!![:)]
 
http://www.delphibbs.com/delphibbs/dispq.asp?LID=854583
Windows2000下自定义纸张原来可以这样定义的。
 
應該是設置的問題。
 
不好意思搞錯了,請斑竹再加上200分
 
如何在WINDOWS中控制打印字体的长宽,而不受限于SIZE 的限制


首先为了达到这个功能,可以采用Windows的逻辑字体(LogFont)

可以使用 CreateFont 或 CreateFontIndirect 这两个Windows API

函数来定义任何想要的字体,由于 CreateFont 所需的参数甚多通常

我们使用 CreateFontIndirect 来建立所需的逻辑字体,这个API函数

在Delphi中的声明为

function CreateFontIndirect(const p1: TLogFont): HFONT;
stdcall;

其中只有一个参数 p1: TLogfont

所有有关字体的参数完全通过这个

TLogfont结构来传送,Windows将根据结构中的内容创建出相应的逻辑

字体,在Delphi的Windows.pas中TLogFont是这样定义的


TLogFontA = packed record

lfHeight: Longint;

lfWidth: Longint;

lfEscapement: Longint;

lfOrientation: Longint;

lfWeight: Longint;

lfItalic: Byte;

lfUnderline: Byte;

lfStrikeOut: Byte;

lfCharSet: Byte;

lfOutPrecision: Byte;

lfClipPrecision: Byte;

lfQuality: Byte;

lfPitchAndFamily: Byte;

lfFaceName: array[0..LF_FACESIZE - 1] of AnsiChar;

end;


TLogFontW = packed record

lfHeight: Longint;

lfWidth: Longint;

lfEscapement: Longint;

lfOrientation: Longint;

lfWeight: Longint;

lfItalic: Byte;

lfUnderline: Byte;

lfStrikeOut: Byte;

lfCharSet: Byte;

lfOutPrecision: Byte;

lfClipPrecision: Byte;

lfQuality: Byte;

lfPitchAndFamily: Byte;

lfFaceName: array[0..LF_FACESIZE - 1] of WideChar;

end;


TLogFont = TLogFontA;


其中涉及到很多参数,其中


lfHeight: Longint;

指定以逻辑单位标定的字体高度,取值可为正负或零,对于需要随意

定义字体高度的情况下通常取负值,以保证获得实际尺寸的字体。


lfWidth: Longint;

用于指定字体的平均宽度,由于Windows系统下的大多数字体都是比例

字体因而采用平均宽度这个表示方法。若指定为0,则系统会自动根据

适当的比例自动处理宽度。


lfEscapement: Longint;

指定输出方向与当前坐标系X轴之间的以十分之一度为单位的角度。


lfOrientation: Longint;

指定每个字符与当前坐标系X轴之间的以十分之一度为单位的角度。在

Windows95中这个值等同于lfEscpement。


lfWeight: Longint;

指定范围为从0至1000的字体加重程度,400是标准字体700为加重字体,

0表示采用默认值。


lfItalic: Byte;

不为0表示采用斜体字。


lfUnderline: Byte;

不为0表示带下划线。


lfStrikeOut: Byte;

不为0表示带穿透线。


lfCharSet: Byte;

指定字体集。


lfOutPrecision: Byte;

指定输出精度。用于确定对前面一些设定值的精确程度。


lfClipPrecision: Byte;

指定裁剪精度。裁剪是Windows图形环境下的一种特殊处理,简单说就是

去掉图形中落在视图以外的部分,有助于提高图形的处理速度。


lfQuality: Byte;

指定输出质量。


lfPitchAndFamily: Byte;

指定字体的Pitch和Family。


lfFaceName: array[0..LF_FACESIZE - 1] of AnsiChar;

指定采用的字体名称。


在建立逻辑字体时,我们通常使用


lfHeight和lfWidth来确定字体的尺寸,使用lfEscapement和lfOrientation

来确定字体的输出方向,使用lfWeight

lfItalic

lfUnderline


lfStrikeOut

来确定字体的加重,斜体,下划线和穿透线,使用lfCharSet

来确定字体的字符集,通常采用系统默认的字符集。

对于lfOutPrecision

lfClipPrecision

lfQuality一般应用于对屏幕之外

的输出设备,通常采用默认值。采用lfPitchAndFamily来确定采用定宽或可

变字体和字体的家族。以lfFaceName来通过名称选择采用的字体。

另外应当注意在Windows环境下,每种字体具体输出为何种形式取决于很多

因素,需要对以上这些参数进行有效的组合才能达到所要的效果。
 
这个问题我碰到过,是打印机属性里的“无法打印区域”未设置好,
你将未打印区域设为0,0,99999,99999应该可以了
 
多人接受答案了。
 
顶部