当前位置:主页>销售管理软件> 列表

如何自定义纸张尺寸(宽24厘米,8英寸,宽9厘米3英寸) 找批发零售软件

进销存软件版1楼: 如何自定义纸张尺寸(宽24厘米或8英寸,宽9厘米或3英寸),请给出完整源代码,还有指针符号^怎么输入

2楼: file://设置纸张高度-单位:mm
procedure SetPaperHeight(Value: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
file://自定义纸张最小高度127mm
if Value < 127 then Value := 127;
 file://自定义纸张最大高度432mm
 if Value > 432 then Value := 432;
  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 := Value * 10;
     pDMode^.dmFields := pDMode^.dmFields or DMBIN_MANUAL;


     pDMode^.dmDefaultSource := DMBIN_MANUAL;
     GlobalUnlock(hDMode);
    end;
   end;
   Printer.PrinterIndex := Printer.PrinterIndex;
end;

file://设置纸张宽度:单位--mm
Procedure SetPaperWidth(Value: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
file://自定义纸张最小宽度76mm
if Value < 76 then Value := 76;
 file://自定义纸张最大宽度216mm
 if Value > 216 then Value := 216;
  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_PAPERWIDTH;
    pDMode^.dmPaperSize := DMPAPER_USER;
    file://将毫米单位转换为0.1mm单位
    pDMode^.dmPaperWidth := Value * 10;


    pDMode^.dmFields := pDMode^.dmFields or DMBIN_MANUAL;
    pDMode^.dmDefaultSource := DMBIN_MANUAL;
    GlobalUnlock(hDMode);
   end;
  end;
  Printer.PrinterIndex := Printer.PrinterIndex;
end; 如仓库进销存流程

3楼: royal1442 你好!我使用了你的给出的上面的代码和我下面的代码,打印出来有走纸到整个纸张走完,不能按自定义的纸张走纸。你看看是哪里有问题,请帮我修改,以下我的代码:
procedure Tshowprint1Form.toprint(Sender: TObject);
var x,y,i,temhi,temwd:integer;
strect:Trect;
ADevice,Adriver,APort:string;
PDevice,Pdriver,PPort:array[0..255] of char;
hDMODE:THandle;
PDMODE:PDevicemode;
begin
//打印
SetPaperHeight(90);
SetPaperWidth(240);
temhi:=image1.Picture.Height ;
temwd:=image1.Picture.width ;
while (temhi begin
temhi:=temhi+temhi;


temwd:=temwd+temwd;
end;
with strect do
begin
left:=1;
top:=1;
right:=left+temwd;
bottom:=top+temhi;
end;
with printer do
begin
begindoc;
canvas.stretchDraw(strect,image1.picture.graphic);
enddoc;
end;
end;

procedure Tshowprint1Form.tofile(Sender: TObject);
var image:Timage;
bitMap:Tbitmap;
begin
Image:=TImage.Create(Self);
BitMap:=TBitMap.Create ;
bitMap.Width :=240;
bitMap.Height:=90;
BitBlt(BitMap.Canvas.Handle,0,0,240,90,GetDC(Handle),
0,0,SRCCOPY);
image.Picture.Graphic:=BitMap;
bitMap.Free;
Image.Free ;
end;

4楼: while (temhi begin
temhi:=temhi+temhi;
temwd:=temwd+temwd;
end;
这个是干吗用的?

5楼: while (temhi begin
temhi:=temhi+temhi;


temwd:=temwd+temwd;
end;
这是自动放大要打印的图片

6楼: 还有你的程序中file:出错,不知道要什么单元或什么支持,我测试过了,不管什么纸都是全部走完,能不能打完图片后,停止在那里或走到自定义的下一张纸去

进销存软件版7楼: file://自定义纸张最小高度127mm
if Value < 127 then Value := 127;
 file://自定义纸张最大高度432mm
 if Value > 432 then Value := 432;
你的是90!

file://自定义纸张最小宽度76mm
if Value < 76 then Value := 76;
 file://自定义纸张最大宽度216mm
 if Value > 216 then Value := 216;
你的是240!

8楼: 我使用的纸张是240x90cm的纸张,而且使用打印图片的方式,但打印完图片后走纸是全部走完纸张,我想只走90cm就可以,而且file指令出错,我把file指令删除了

9楼: 现在的问题是打印打印完图片后不走纸,即打即停

10楼: 包含file的行注释掉即可!
要实现“即打即停”不容易,因为enddoc;事件会提交本次打印,然后走纸的!

11楼: 使用华表的CELL我实现了这个功能,郁闷了好长一段时间,不过有的时候效果也不是非常的好

12楼: 帮顶!

http://www.source520.com

站长开发推广同盟 站长朋友的终极驿站


同时拥有海量源码电子经典书籍下载

http://www.source520.com/search/search.asp

"编程.站长"论坛搜索引擎-----为中国站长注入动力! 如批发零售软件