我刚学打印这一块,不知控件和语句,给一个有功能的源码研究研究,不胜感激
解决方案 »
- 求问!在导出数据库内容到excel中如何添加进度条?
- cport为什么不能用动态数组?
- Query与SQL的参数传递方式
- 如何动态显示flash文件
- 在线等的问题
- 图片太大,怎么让IMAGE出现上下,左右的滚动条,
- mkdir 的i/o错误,在执行Reset(F);出现
- 当我对adoquery1 post 时,出现错误:Row cannot be located for updating。Some values may have been changed since it was last read.
- DELPHI高手请看
- 线程问题
- 怎么知道ADO的连接状态
- (((问个傻问题))))怎样在动态生成控件的时候,让动态生成的相同控件自己复制自己???在线等待.............
var i,j,cwidth:integer;
begin
PointX:=GetDeviceCaps(printer.Handle,LOGPIXELSX)/25.4;//每毫米打印机的像素数
PointY:=GetDeviceCaps(printer.Handle,LOGPIXELSy)/25.4;
cwidth:=0;
coltitlewidth:=0;
Recordcount:=0;
pleft:=strtofloat(zhizhang[0])*PointX;
pright:=strtofloat(zhizhang[1])*PointX;
ptop:=strtofloat(zhizhang[2])*PointY;
pbottom:=strtofloat(zhizhang[3])*PointY;
pwidth:=printer.PageWidth-pleft-pright;
pheight:=printer.PageHeight-ptop-pbottom;
//计算网格每列长度占总长的比例并得到在纸张上相映的位置 SetLength(colsX,len);
SetLength(colswidth,len);
for i:=0 to len-1 do cwidth:=cwidth+strtoint(s[i]);
for i:=0 to len-1 do colswidth[i]:=(strtoint(s[i])/cwidth)*pwidth;
colsx[0]:=pleft;
for i:=1 to len-1 do colsx[i]:=colsx[i-1]+colswidth[i-1];
printer.BeginDoc;
x:=pleft;
y:=ptop;
detailfootheight:=0;
with printer.Canvas do
begin
if mingxi[0]='Vertical' then
begin
Font.Name:= liebaioti[2];
Font.Color:=strtoint(liebaioti[3]);
Font.Size:=strtoint(liebaioti[4]);
Font.Style:= strtoFontStyle(liebaioti[5]);
for i:=0 to length(liebaiotistr)-1 do
if coltitlewidth<TextWidth(liebaiotistr[i]) then coltitlewidth:=TextWidth(liebaiotistr[i]);
end;
if strtobool(mingxiwei[0]) then
begin
Font.Name:= mingxiwei[3];
Font.Color:=strtoint(mingxiwei[4]);
Font.Size:=strtoint(mingxiwei[5]);
Font.Style:= strtoFontStyle(mingxiwei[6]);
detailfootheight:= TextHeight('无')+10;
end;
if strtobool(yemei[0]) then
begin
printpageheader;
y:=y+20;
end;
if strtobool(biaoti[0]) then printtitle;
y:=y+strtoint(mingxi[3])*PointY;
if strtobool(mingxitou[0]) then printDetailhead;
Pen.Color:=strtoint(biankuang[0]);
Pen.Style:=strtopenStyle(biankuang[1]);
Pen.Width:=strtoint(biankuang[2]);
Polyline([point(x,y),point(pwidth+pleft,y)]);
if strtobool(liebaioti[0]) and (strtoArrange(mingxi[0])<>Vertical) and not strtobool(liebaioti[8]) then printcolstitle;
Pen.Color:=strtoint(biankuang[0]);
Pen.Style:=strtopenStyle(biankuang[1]);
Pen.Width:=strtoint(biankuang[2]);
Polyline([point(x,y),point(pwidth+pleft,y)]);
Pen.Color:=strtoint(hengxian[0]);
Pen.Style:=strtopenStyle(hengxian[1]);
Pen.Width:=strtoint(hengxian[2]);
Polyline([point(x,y),point(pwidth+pleft,y)]);
hang:=0;
while memo[hang]<>'???????????????????????????????????????????????' do hang:=hang+1;
hang:=hang+1;
for i:=hang to memo.Count-2 do
begin
len:=0; //读入各个字段内容
SetLength(mingxistr,len);
for j:=0 to length(widestring(memo[hang])) do
if widestring(memo[hang])[j]='┆' then
begin
len:=len+1;
SetLength(mingxistr,len);
end else if len>0 then mingxistr[len-1]:=mingxistr[len-1]+widestring(memo[hang])[j];
if y+detailrowheight+detailfootheight>pheight+ptop then
begin
Pen.Color:=strtoint(biankuang[0]);
Pen.Style:=strtopenStyle(biankuang[1]);
Pen.Width:=strtoint(biankuang[2]);
Polyline([point(x,y),point(pwidth+pleft,y)]);
Pen.Color:=strtoint(hengxian[0]);
Pen.Style:=strtopenStyle(hengxian[1]);
Pen.Width:=strtoint(hengxian[2]);
Polyline([point(x,y),point(pwidth+pleft,y)]);
if strtobool(yejiao[0]) then printpagefooter;
//*******换页*********
printer.NewPage;
x:=pleft;
y:=ptop;
if strtobool(yemei[0]) then
begin
printpageheader;
y:=y+20;
end;
if strtobool(biaoti[8]) and strtobool(biaoti[0]) then printtitle ;//每页打印标题
if strtobool(liebaioti[0]) and (strtoArrange(mingxi[0])<>Vertical) and strtobool(liebaioti[7]) and not strtobool(liebaioti[8]) then printcolstitle //每页打印列标题
else begin
Pen.Color:=strtoint(biankuang[0]);
Pen.Style:=strtopenStyle(biankuang[1]);
Pen.Width:=strtoint(biankuang[2]);
Polyline([point(x,y),point(pwidth+pleft,y)]);
end;
end;
if strtobool(liebaioti[0]) and (strtoArrange(mingxi[0])<>Vertical) and strtobool(liebaioti[8]) then previewcolstitle; //每个明晰打印列标题
printDetail;
Recordcount:=Recordcount+1;
Pen.Color:=strtoint(hengxian[0]);
Pen.Style:=strtopenStyle(hengxian[1]);
Pen.Width:=strtoint(hengxian[2]);
Polyline([point(x,y),point(pwidth+pleft,y)]);
hang:=hang+1;
end;
Pen.Color:=strtoint(biankuang[0]);
Pen.Style:=strtopenStyle(biankuang[1]);
Pen.Width:=strtoint(biankuang[2]);
Polyline([point(x,y),point(pwidth+pleft,y)]);
if strtobool(mingxiwei[0]) then printDetailfoot;
if strtobool(yejiao[0]) then printpagefooter;
printer.EndDoc;
end;
end;这是我做的打印控件的一部分代码给分
给分
给分
给分
给分
给分
给分
给分
给分
给分
给分
给分
给分
给分