L
LargeWang
Unregistered / Unconfirmed
GUEST, unregistred user!
取A4幅面,打印机一行能够容纳字数与屏幕显示一行容纳的字数不同,我的方法是
调整屏幕“A4页面”的高宽使其能显示同打印机一样的字数,我的方法可行吗?你能提
出更好的解决办法吗?
现在我把代码贴出来(已经改得很乱了,请不要扔砖头,请多见谅)
有兴趣的富翁帮我改一改,先在此谢过!
/////////////////////////////////////////////////////////////////////////////
打印部分
/////////////////////////////////////////////////////////////////////////////
{
2001.6 王珍义
}
unit PreviewPanel;
interface
uses
Windows, Sysutils, Classes, Printers, Graphics, Controls, Dialogs, Extctrls,
Comctrls, Math, Forms;
type
TMargin = TRect;
TPaintProc = procedure of Object;
TPrinterState = (psPrint, psPreview, psIdle);
TSize = TPoint;
TPreviewPanel = class(TPanel)
private
FBmpRateX: Single;
FBmpRateY: Single;
FCanvas: TCanvas;
FCurrColumnX: Integer;
//pixels
FColumns: Integer;
FColumnWidth: Integer;
//单行文本宽
FContentHeight: Integer;
FCurrPoint: TPoint;
FLineHeight: Integer;
ForgMargin: TMargin;
FMargin: TMargin;//cm
FOnPaint: TPaintProc;
FOrgPoint: TPoint;
FPrinterState: TPrinterState;
FPageNo: Integer;
FPageSize: TSize;//Point
FRateX: Single;
FRateY: Single;
FWRate: Single;
//打印机字符宽度与屏幕字符宽度比率
FHRate: Single;
//打印机字符高度与屏幕字符高度比率
FStatusBar: TStatusBar;
FPageCount: Integer;
FLineSpace: Single;
procedure AdjParms;
procedure ChangePage;
procedure ChangeColumn;
procedure ChangeLine;
function CmToPixels(cm: Integer): TPoint;
procedure SetColumns(const Value: Integer);
procedure SetMargin(const Value: TMargin);
procedure SetCurrPoint(const Value: TPoint);
procedure AdjustLineWidth;
procedure SetPageSize(const Value: TSize);
procedure SetStatusBar(const Value: TStatusBar);
procedure SetPageCount(const Value: Integer);
procedure SetLineSpace(const Value: Single);
public
constructor Create(Owner: TComponent);
override;
property OrgPoint: TPoint read FOrgPoint write FOrgPoint;
property ContentHeight: Integer read FContentHeight;
property ColumnWidth: Integer read FColumnWidth;
property CurrPoint: TPoint read FCurrPoint write SetCurrPoint;
property LineSpace: Single read FLineSpace write SetLineSpace;//以行高为单位
property PageSize: TSize read FPageSize write SetPageSize;
property PrinterState: TPrinterState read FPrinterState;
property PageNo: Integer read FPageNo default 1;
procedure Paint;
override;
procedure AddText(Str: string);
procedure AddPicture(Bmp: TBitmap);
procedure AddSpaceLine(Count: Integer);
procedure Print;
procedure Preview;
procedure ResetPos;
destructor Destroy;
override;
published
property Columns: Integer read FColumns write SetColumns default 1;
property Margin: TMargin read FMargin write SetMargin;
//以厘米为单位
property PageCount: Integer read FPageCount write SetPageCount default 1;
property StatusBar: TStatusBar read FStatusBar write SetStatusBar;
property OnPaint:TPaintProc read FOnPaint write FOnPaint;
end;
const
cmpI = 2.54;//每英寸2.45厘米 ??????????
implementation
{ TPreviewPanel }
procedure TPreviewPanel.AddPicture(Bmp: TBitmap);
var
bmpW, bmpH: Integer;
begin
try
if FPrinterState = psPrint then
begin
bmpW := Round((Bmp.Width) * FBmpRateX);
bmpH := Round((Bmp.Height) * FBmpRateY);
end else
begin
bmpW := Round(Bmp.Width);
bmpH := Round(Bmp.Height);
end;
if (FColumnWidth < bmpW) and Assigned(FStatusBar) then
FStatusBar.SimpleText := ('列宽不足以容纳图形');
if (FContentHeight < bmpH) and Assigned(FStatusBar) then
FStatusBar.SimpleText := '页高不足以容纳图形';
if (bmpH - FLineHeight) >
FPageSize.y * FPageNo - FCanvas.PenPos.y - FMargin.Bottom then
ChangeColumn;
if (FCanvas.PenPos.x < FOrgPoint.x) or (FCanvas.PenPos.y < FOrgPoint.y) then
CurrPoint := Point(FOrgPoint.x, FOrgPoint.y);
FCanvas.StretchDraw(Rect(FCurrPoint.x, FCurrPoint.y,
FCurrPoint.x + bmpW, FCurrPoint.y + bmpH), bmp);
if FPrinterState = psPreview then
CurrPoint :=Point(FCurrColumnX,
FCurrPoint.y + Ceil(Bmp.Height / FLineHeight) * FLineHeight)
else
if FPrinterState = psPrint then
CurrPoint :=Point(FCurrColumnX,
FCurrPoint.y + Ceil(Bmp.Height / FLineHeight * FBmpRateY) * FLineHeight);
except
end;
end;
procedure TPreviewPanel.AddSpaceLine(Count: Integer);
begin
CurrPoint := Point(FCurrPoint.x, FCurrPoint.y + FLineHeight * Count);
end;
procedure TPreviewPanel.AddText(Str: string);
var
I, J, W: Integer;
tmpStr, tmpStr1: string;
WStr, WStr1: WideString;
begin
tmpStr := '';
WStr := Str;
for I := 1 to Length(WStr)do
begin
tmpStr := tmpStr + WStr;
{ W := Canvas.TextWidth(tmpStr);
if W >= FColumnWidth then
begin
FCanvas.TextOut(Canvas.PenPos.x, Canvas.PenPos.y, tmpStr);
tmpStr := '';
ChangeLine;//CurrPoint := Point(FCanvas.PenPos.x + 20, FCanvas.PenPos.y);
end;
}
///////////////////// ???????????????????
W := Printer.Canvas.TextWidth(tmpStr);
if W >= FColumnWidth * FRateX then
begin
if FPrinterState = psPrint then
FCanvas.TextOut(FCanvas.PenPos.x, FCanvas.PenPos.y, tmpStr)
else
begin
WStr1 := tmpStr;
W := 0;
J := 1;
tmpStr1 := '';
while W < FColumnWidthdo
begin
tmpStr1 := tmpStr1 + WStr1[J];
W := Canvas.TextWidth(tmpStr1);
Inc(J);
end;
FCanvas.TextOut(FCanvas.PenPos.x, FCanvas.PenPos.y, tmpStr1);
ChangeLine;
end;
tmpStr1 := '';
tmpStr := '';
end;
////////////////////////
end;
if tmpStr <> '' then
begin
FCanvas.TextOut(FCanvas.PenPos.x, FCanvas.PenPos.y, tmpStr);
tmpStr := '';
ChangeLine;
end;
end;
procedure TPreviewPanel.AdjustLineWidth;
begin
FColumnWidth := Round((FPageSize.x div Columns - Round((FMargin.Right + FMargin.Left))) * FWRate);
if FColumnWidth > 20000 then
raise Exception.Create('列宽调试错误!');
FContentHeight := FPageSize.y - Round((FMargin.Top + FMargin.Bottom));
end;
constructor TPreviewPanel.Create(Owner: TComponent);
var
ppIs: Integer;
begin
Inherited;
FLineSpace := 0.5;
FCanvas := Canvas;
FPrinterState := psIdle;
FColumns := 1;
FPageCount := 1;
FColumnWidth := Width;
FCurrColumnX := 0;
FCanvas.Font.Name := '宋体';
FCanvas.Font.Size := 9;
ppIs := Canvas.Font.PixelsPerInch;
if Printer.PrinterIndex >= 0 then
begin
FRateX := GetDeviceCaps(Printer.Handle, LOGPIXELSX) / ppIs;
FRateY := GetDeviceCaps(Printer.Handle, LOGPIXELSY) / ppIs;
end else
begin
FRateX := 6.25;
FRateY := FrateX;
end;
FBmpRateX := FRateX;
FBmpRateY := FRateY;
FWRate := 1;
FHRate := 1;
end;
destructor TPreviewPanel.Destroy;
begin
inherited;
end;
procedure TPreviewPanel.Paint;
var
I: Integer;
begin
inherited;
if Printer.PrinterIndex >= 0 then
PageSize := Point(Printer.PageWidth, Printer.PageHeight)
else
PageSize := Point(4362, 6414);
FCanvas.Pen.Color := clBlack;
FCanvas.Brush.Color := clWhite;
FLineHeight := Round((1 + FLineSpace) * FCanvas.TextHeight('用大田小永'));
FCanvas.FillRect(Rect(0, 0, Width, Height));
FOrgPoint := Point(FMargin.Left, FMargin.Right);
FCurrColumnX := FMargin.Left;
FPageNo := 1;
if FPrinterState = psIdle then
Exit;
if Assigned(FOnPaint) and (FPrinterState <> psIdle) then
begin
FOnPaint;
end;
for I := 2 to FPageCountdo
begin
Canvas.MoveTo(0, (I - 1) * FPageSize.y);
Canvas.LineTo(FPageSize.x, (I - 1) * FPageSize.y);
end;
end;
procedure TPreviewPanel.ResetPos;
begin
CurrPoint := FOrgPoint;
end;
procedure TPreviewPanel.SetColumns(const Value: Integer);
begin
FColumns := Value;
FContentHeight := FPageSize.y - (FMargin.Bottom + FMargin.Top);
AdjustLineWidth;
end;
procedure TPreviewPanel.ChangePage;
{var
FontSize: Integer;
}
begin
if FPrinterState = psIdle then
Exit;
// FontSize := FCanvas.Font.Size;
{ try
FCanvas.Font.Size := 7;
//FCanvas.MoveTo(FCurrColumnx, FCanvas.PenPos.y + FLineHeight);
FCanvas.TextOut(FCurrColumnX, FCanvas.PenPos.y + FLineHeight, '第' + IntToStr(FPageNo) + '页');
finally
FCanvas.Font.Size := FontSize;
end;
}
Inc(FPageNo);
if FPrinterState = psPrint then
begin
Printer.NewPage;
FCurrPoint := Point(FMargin.Left, FMargin.Top);
FCurrColumnX := FOrgPoint.x;
end else
begin
FOrgPoint := Point(FMargin.Left,
(FContentHeight + FMargin.Top + FMargin.Bottom) * (FPageNo - 1) + FMargin.Top);
FCurrPoint := FOrgPoint;
FCurrColumnX := FMargin.Left;
FCanvas.MoveTo(0, FCurrPoint.y - FMargin.Top);
//在页间画直线
FCanvas.LineTo(Width, FCurrPoint.y - FMargin.Top);
end;
CurrPoint := Point(FOrgPoint.x, FOrgPoint.y);
end;
procedure TPreviewPanel.SetCurrPoint(const Value: TPoint);
begin
FCurrPoint := Value;
if FCurrPoint.x < FMargin.Left then
FCurrPoint.x := FMargin.Left;
if FCurrPoint.y < FMargin.Top then
FCurrPoint.y := FMargin.Top;
if FCurrPoint.x >= FCurrColumnX + FColumnWidth then
ChangeLine
else
if FCurrPoint.y >= FOrgPoint.y + FContentHeight then
//换列
ChangeColumn
else
if FCurrPoint.x >= PageSize.x - FMargin.Right then
//换页
ChangePage;
FCanvas.MoveTo(FCurrPoint.x, FCurrPoint.y);
end;
procedure TPreviewPanel.SetMargin(const Value: TMargin);
begin
ForgMargin := Value;
FMargin.Left := CmToPixels(Value.Left).x;
FMargin.Top := CmToPixels(Value.Top).y;
FMargin.Right := CmToPixels(Value.Right).x;
FMargin.Bottom := CmToPixels(Value.Bottom).y;
AdjustLineWidth;
FOrgPoint := Point(FMargin.Left, FMargin.Top);
CurrPoint := Point(FMargin.Left, FMargin.Top);
FCurrColumnX := FOrgPoint.x;
end;
procedure TPreviewPanel.SetPageCount(const Value: Integer);
begin
FPageCount := Value;
end;
procedure TPreviewPanel.SetPageSize(const Value: TSize);
begin
FPageSize := Point(Round(Value.x / FRateX), Round(Value.y / FRateY));
AdjustLineWidth;
if FPrinterState <> psPrint then
begin
Width := FPageSize.x;
Height := FPageSize.y * FPageCount;
end;
end;
procedure TPreviewPanel.SetStatusBar(const Value: TStatusBar);
begin
FStatusBar := Value;
FStatusBar.SimplePanel := True;
end;
procedure TPreviewPanel.ChangeColumn;
begin
if FPrinterState = psIdle then
Exit;
FCurrColumnX := FCurrColumnX + FColumnWidth + FMargin.Right + FMargin.Left;
if FCurrPoint.x > 10000 then
Raise Exception.Create('调试出错!');
CurrPoint := Point(FCurrColumnX, PageSize.y * (FPageNo - 1) + FMargin.Top);
end;
procedure TPreviewPanel.ChangeLine;
begin
if FPrinterState = psIdle then
Exit;
CurrPoint := Point(FCurrColumnX, FCurrPoint.y + FLineHeight);
end;
procedure TPreviewPanel.Preview;
begin
FCanvas := Canvas;
FLineHeight := Round((1 + FLineSpace) * FCanvas.TextHeight('用大田小永'));
try
//SetMapMode(Printer.Canvas.Handle, MM_LOMETRIC);
FCanvas.Font.Size := 9;
FCanvas.Font.Name := '宋体';
FPrinterState := psPreview;
AdjParms;
Paint;
finally
end;
end;
procedure TPreviewPanel.Print;
var
oldSize: TSize;
oldMargin: TRect;
oldRateX, oldRateY: Single;
begin
if Printer.PrinterIndex < 0 then
begin
ShowMessage('未安装打印机!');
Exit;
end;
FCanvas := Printer.Canvas;
FLineHeight := Round((1 + FLineSpace) * FCanvas.TextHeight('用大田小永'));
oldMargin := FMargin;
oldSize := FPageSize;
oldRateX := FRateX;
oldRateY := FRateY;
Canvas.Lock;
try
Printer.begin
Doc;
// SetMapMode(Printer.Canvas.Handle, MM_LOMETRIC);
try
FPrinterState := psPrint;
FCanvas.Font.Size := 9;
FCanvas.Font.Name := '宋体';
FRateX := 1;
FRateY := 1;
PageSize := Point(Printer.PageWidth, Printer.PageHeight);
Margin := ForgMargin;
FPageNo := 1;
if Assigned(FOnPaint) and (FPrinterState <> psIdle) then
begin
FOnPaint;
end;
Printer.EndDoc;
// Printer.Abort;
except
Printer.Abort;
if Assigned(FStatusBar) then
FStatusBar.SimpleText := '打印出错!';
end;
finally
Canvas.Unlock;
FPrinterState := psPreview;
FCanvas := Canvas;
FRateX := oldRateX;
FRateY := oldRateY;
FMargin := oldMargin;
PageSize := oldSize;
Self.Update;
end;
end;
function TPreviewPanel.CmToPixels(cm: Integer): TPoint;
var
ppIs: Integer;
begin
ppIs := Canvas.Font.PixelsPerInch;
if (FPrinterState = psPreview) or (FPrinterState = psIdle) then
Result := Point(Round(cm / cmpI * ppIs), Round(cm / cmpI * ppIs))
else
if FPrinterState = psPrint then
Result := Point(Round(cm / cmpI * GetDeviceCaps(Printer.Handle, LOGPIXELSX)),
Round(cm / cmpI * GetDeviceCaps(Printer.Handle, LOGPIXELSY)));
end;
procedure TPreviewPanel.AdjParms;
begin
// FWRate := FRateX / (Printer.Canvas.TextWidth('用') / Canvas.TextWidth('用'));
FColumnWidth := Round(FColumnWidth * FWRate);
FPageSize.x := Round(FPageSize.x * FWRate);
FPageSize.y := Round(FPageSize.y * FHRate);
FMargin.Left := Round(FMargin.Left * FWRate);
FMargin.Top := Round(FMargin.Top* FHRate);
FMargin.Right := Round(FMargin.Right* FWRate);
FMargin.Bottom := Round(FMargin.Bottom * FHRate);
FOrgPoint := Point(FMargin.Left, FMargin.Right);
FContentHeight := FMargin.Bottom - FMargin.Top;
if FPrinterState = psPreview then
begin
//Width := Round(Width * FWRate);
//Height:= Round(Height* FHRate);
end;
//AdjustLineWidth;
end;
procedure TPreviewPanel.SetLineSpace(const Value: Single);
begin
FLineSpace := Value;
if Value > 4 then
FLineSpace := 4;
FLineHeight := Round((FLineSpace + 1) * FCanvas.TextHeight('用大田小永'));
end;
end.
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////
测试窗体
////////////////////////////////////////
object fmPreview: TfmPreview
Left = 154
Top = 178
Width = 800
Height = 493
Caption = '打印预览'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -14
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 120
TextHeight = 16
object pnlTop: TPanel
Left = 0
Top = 0
Width = 792
Height = 50
Align = alTop
BevelInner = bvLowered
TabOrder = 0
object Image1: TImage
Left = 428
Top = 60
Width = 130
Height = 130
IncrementalDisplay = True
Picture.Data = {
07544269746D6170A6420000424DA642000000000000A6020000280000008000
000080000000010008000000000000400000120B0000120B00009C0000009C00
00004A526B004A5A7300424A5A00424A63004A52630042526B004A4A63004A52
7300525A7B00525A73005A6B8C004A5A7B00526384004252630052637B004A4A
5A005A6384004A5A6B004A637B0052526B0042425200424A5200525273005A63
8C004A6384003942520029293900425A730021293100425273005A6B8400526B
8C00394A5A002129390042425A00526B840029314200424A6B00525A6B002931
39005A5A7B004A4A6B00425A6B0029293100525263005A637B0031394A003942
5A0052638C005A5A7300525A840039424A004A637300394A630039394A003131
42004A4A5200524A630042424A005263730042525A00394A52004A5A84004A42
520021212900395263004A525A00313952003142520039526B00313942004A6B
840021213100425A7B00636B8C004A6B8C004A527B00393942005A6B94005A73
94005A738C0029394200524A5A005A5A840039395200526B94005A6373006363
7B00636384005A526B0052527B002131390042637B0031314A00527394005273
8C0029314A005A5A6B00524A6B0031313900395A73005A526300426384006373
940031424A00212929004A638C005A5273004A425A00635A730029394A00636B
840031313100395273006B7B940042394A0063738C00637B9C006B7394003142
5A00526B7B00394A6B005A739C005A6B7B00636B9400424A4A0063739C005A7B
9C00527B9400426B84006B6B840052739C00424263004263730021314200635A
7B00314A6300425A63006B5A730052425A005A4A63004A738C00425A84005A7B
9400635273002921310052525A003931420029294200525A8C0039426300527B
A5006384A500395A7B00424A7300635A84000A0A170A0A0A0A0A0A0A0A0A0A0A
170C080A010F010B6A4D630215060D0B0E080C0C0808171F4E310C1304083401
0403150911000F040504061E090418130000280809090904003900020B000602
06002C02020000152C070C26012C11080E0100100A3205010B1816160C100C0A
0A0A0A0A0A0A0A0A0A0A100A0A1E0A0A0A0A0C100C0C0C0C100C171302010001
0105011808010109080070143113062600050809121601080E0A180A1312003B
001411160100110211190E2357260107060D00000E08180004090D1D011D0602
04061B050412020513000C0108071D0C0B1F09170A1300080B010B0508000B0E
18080000070C10100C100A0C1017100C100C060203150500060F000302140000
000103000D00130C4A0E020C572D0C010005080C0E28503B100A2313053B0912
2A0F020F050600030261090000010F083409000E060506021B3A0235042C2A18
090539141E010D0312020405140B00004B170901094D3301094C080108070001
0706023D0D020002000106020B0101022502050D020649001D01331405190203
250D0600080E170A0A0C121F0C0E0113060101045700105300010411002C0007
0200010009010B0F0E311E6426090406090E0009110F023F0600040F0204030D
04041209100E050F060D070F120401080101120E0E00040A0A0E08080712082A
063C1B0600060D1220261B0D0B00011D0904060025150206330202190304040D
09100C100A170A0C090B060604010E011114000E07162D100C01110F02011200
0404060000020D0E09080501120E171F09090004070F14150304090E13311129
0915010010010306110000090703010C010107130B01000C0A100A0A0C0C0813
0603060D05002816260300060607070E1B020300050625000F0B16000E4E4A0A
0A170A0A09000D0018080A10311056180107784A0D000112010139020F25110F
00130410000004071F0C00090B110B010D00040701121602022809230E260009
13390606010711026C340A3E0006125F31015201280E0306000C080E170A0A0A
0C090106040500050C09051D000603040206000B00090A0A0A170A4E1E0C0C0C
080E00061914030901090C0A0A3109122331230C09120E06055711020F020100
0111080D0118282D0025111100080B3B060C04010004060F0203000B020B110E
0C0D0309030D01130007010B002C2D01001F30113F9B900100180C102D000600
100E0C530C0711040200360D080C000106000A171E17170C010E010003190609
0F22020D020501002D0E560C0E2D130909120403021B08010F2A073C0D0D0F01
06041D02020601112A410B180C0E00098D0B06052608130202040D092C050901
2A020209040602010F1D3B0D070B0C0006000507010E13010010230C0B000604
3A040D26010900010031020316080E100C0E2A0000000100030319153A350D06
091331050703050512101E0C570C0100000000020F0F34000606090A06110B09
0E1E130004061607060406343406010C00023B000B1011010F15060211050700
0D060711042607110400140F03000E120412131213010C00180E0E13011D0D29
2C3F011303061300050B00030B0C121B080100000D0900052203140502050050
06050100150D0202001B040E090034011302130711000107040104132809263B
280C110701081000023306060B01001105051012091F26101604020D0F0D0434
080100063B0111131B040D02151D00000709040E0B1818090C160E0A0C010011
230913041101560F0F0100160E0B00000006010605032A1402031929000B2801
1D06040325001B05032002050101120E04018001090905000B0C090018725728
2D1F093C090E18130D06003C0501070D0113230C16090E0E00040429060B0D03
030004001206031326221403030285073B0712080B080804080A0C0C0C080001
0B11132A01091200001500080C0B060D090405153F0006030203020D25001202
14021902021D0229050214140D220302200412000113050C0E080700000E4B12
121303060B0E103B2C030018030704000E030E08002308101208000E040B1306
000D0000000931040000201503005911090E000C12090C00090C17340E120709
011B0406000000010E0902110A0A0002011B14220101090D0303060207000214
02003302050F3505042214250205023314141401010105010111011800000101
110445000018556F00020E091311001D02020008280E0A12080C31091602000D
0362040501013B0100010215000002000608870C07050708180E120712070B0B
29050D0D1201030214330601100A1007151420660703010302030D1415020305
20000203050014141903030D0D0500050302140D06072902070B011600072507
0708084B010B233E0102000B1F0404072A07000118260C07010B01032A3B0101
3806340F232D010D2A04071539080006092D080E0C010E07015301093907080E
04000D0505140401040009040C170A4F00031403030215000633330F00032202
290502030D250B07013A02071D0603010300041B023D144900000D07000B071F
0C0B125A090E6711000204000003053C00060D0000010C0E090D060606051326
020401040D00650D0503131B051312080007340C0B080C070E070907110E0B0C
08030000041502000D010526081E0A1710050202000329190214331419030207
000402030200023C0515021D1B07250D0006030307010302081005031B090B0C
081808090B2900071F010E260E0701000400000F1126000E0B04140300060D01
0259310000024203061101040909030504001601070B0707001B0C0701070C23
0B0008000F03023C040F06040001100A0A080E00250203031533140325190205
0B07000002020200002502140701033D150D2902020F0B000E005300310B0108
05161112002909131209090E1304110F0D05000B1E0C090B1106060301023802
0C01052603001502030109040C0D6F04000804010128120E00080801070C0B0B
0E01260006040006000402000203071E100A1700020202142002190205620202
0700010D0600000B050004040302291403020511050205130B4C7F0A0B090800
080420040705082609000001061B41021902041B0D160F120C0B0B0D11060402
0D230201061511020605010638040B0B01013905091307080B120C0B0E1F0C0A
01710E0F090101000D0D3C0602040D080A0A0A0025030314226C140507050503
0F08063F451B01280000061D02020009250029050F00000600010118571F2D01
3C061607014C121B08000B1212060D156B2D000D13060E07012C060461030406
00010F1213064200030F001105070B1307070100010412090108280E5A230A0B
0B0909010900000D000F000D02060004080A0C00131502020002050705060F07
021B02060D001104110B030301151502021415331405030103020513010B1829
001E2D1011070229050005030C3D14001101040707040000040B0E0708040600
000B050E0109040D0D04010613080B10120C0808070C0708080B0E0701124C0C
0911160B011300021504033D02053126100A0002030F06020103070503056402
111D00002A090B16060F0D3A3814223D1419030D0215220B101605010700010B
0C4B180C0F011D122905290214220008571E00040B0604060016040B01390005
000108008109010813282818085F23171F4E67300E0112010701580C0C2D0713
1D010101090E0000000002060211560A0A0C022C03042006000D050107060603
05010D08010B0026000F0638060F051D15023D1403060D0F1812050202030E07
2509163E0007070307000219141305124708080002140700040501060B060526
07010506582D0900131212070B3E0A582875670A0C07010113230C0810180101
06010D090D0D000D0301140D0300100A1007020505020F030305060704000429
060D0300000C010704040000040500000619030F2502030600390F1415250004
050011051D0B4B16000D03060002010E490E0403000D000400004908090D0303
001801000C0C09100711130C0E0908010A18320C010C01011207182308090807
011B1611000000004102030213100A1007150D0501022904020300070D000500
000613000000010504130B0009000D0B1D1809000345020202050B0107040300
2900010438140204020205020000073208090001001313041611000B11080931
0100090C0C2D5C0E000F07010C0710160C0C16120B1305070116013208010800
07071B0403020006031503140C0A10000F000F000D05000D02060F020D060001
1E1F00062A160105013404013911070706065C281B06060302193D050D030205
017106060008060F050007070F00040D1D3C07000B0B0B090204010D00161F23
0804130E0B0C0B070101090001321E0A1F2D320B0C0900070B01120B1E01490E
012A050929010215202214020C1003070D020D140D000000061505070F01060B
01041307040700000F03031D0C0B05001804022C02020D05021503141B38030D
04020D04010713050315030700070307002900020716010500050006052D1001
0B070707090E080C09160900101E000C231F100A0B1B01120B072A3E01160E00
0700000001000306220D0F060C000304000404000215330020020D3C05000514
38110B010808180907000B000513231601060D0309050D03140202030D040011
0F0405071B010E090011001B0705000025000104070006060304160B58051108
080800010008280909012A000908307F301F1F0C0C0B321813040808580C0B0C
1609090900031B070D03160917260404038C050D190303033A03020214130452
00080013070102160B010000021D060D0007000029050602020F14030D030003
0100020011133902022C0000030505050700052500000300040045120E080423
0E0B00050E11230E0C01160B0C0B1B1F1F2308183008100E04000001181F0112
01230003000005000001050E0A000203050504143303027D030605390003000D
00040B0C0E0109012D0816080B290002080100050429420B070406222015380D
0016003B0B0B09110F03001D01041B002A110009070006040000000034050000
0108071001071210093209160908163018070107090C550E070C00070E000004
0600000704010700050000070A0015021122143A2215063325010F1905000302
006B010F00010B131008030D070100070B0C16020D2607110B03040107000E0B
0104043400130E1607011809060403000F0605000D3C0500040201050001060D
060D0B230E07181E2D0B0E0E1E311F000807080001010601080C0008011D1105
01000109000506000105000E170039000211020C10040D220D02220002030F02
070903040101081601060502070106000C0E0B0025070400000207030B000807
110709080002111B120E28160D2C000E044C34250004000311061107040B1303
00000D01070C230908010C0E2C124A010E080004074900071D180B0B0E130D07
0308291D00031103060F050E170105022233000A0B0436030202190320020303
030503051116000509080E05070900050709080D2911051300000004264C0901
010105420000030D0518310D0D2A0000050B060F04050604050B0100072A0104
0006003204003B090901000B0108230E080C3B07002810100A09280801080005
0D1101000D030038050D04011E0002031503080A3205020F153514390320030F
03000309050D010C2D010300010331060C000305030F14000F0D090704000000
03043505040D0015033D1405080603020107043502070000090B00000406001B
0201003C160C180811070E28320700080E0E00161210304E1F1E0C0001030401
0300050D0D0103023F152908171100030600000A100C01252203200006020202
030411020D0D0B01010E07120F040B0801000000110506040402020906380020
350302030415040007061606151D130512100000000F0000060100010B010314
0311070701090B090B09180B0C0701040E0101083230101F0A1F340001060501
0205000B020029010B0411091E170C000D01040B0E0E0803021919050D020505
0505290300060E01080B0E0B1608002D0B070F000304040D0605060000070208
0F3A0D070C063313520D0203030B1D052C0303000001000D05000B0101070029
13010101130B070E01000301110C010609130E050B170C0C95230B0413110711
00060405040003010205060B0A100A17153305050D08000D1919140207060600
022204281100071301050B000C0C0905100912070D42070F000005132A040616
040F0D04000642150200000F080D2D0F080A0D0016062A00160D00070B080101
1B08000B0C00090B071D161658082806492812070C320E1876160100030D0009
010D002903020D0D0D0207130A0A0A0A1E061008100E0325020202350303020D
0604090100002D0100280401070801136A080023050709010500000006060F11
000D0206041919192E1C1A211A21211A2B212B1C271A1A211A1A212B602F332F
1922072A03120B011D000B0998081E000011000B180E0B077A080E0003050300
0109024106050F0302190D1B0010100A170A1E170A080322030222030D010002
060411100917010012090708181F4B0447110103060301000600010101050400
35193724272B481C1C405B1A4021481C242B1A1A1C1C37212B272121271C1A1A
241C242B5B22010300160E015012010307011D0E32320C531F0C010007000000
0B260D29021B0505050306020301090A0A0A170A0A09020203160D0225001401
0826040E060100393B01040209010115022202000D3507000D00001111002224
1C2B1C2B271C214040212B2427241A5B211A37271A24242460515D21211C2721
1A1C1A1A1A27432E1B010C0808280C3109010108300C0708080B130E03040400
0018092C140514020215000303201408100A0A10000702030303150205018803
07000205080D04090B0E040D0B0407020006030603020F28000D130703241C1A
1A212727242F14441902143405033A020F00180C00420C070907100036362F24
1A1A86212121271A1A6077050E0B0C0C0805080801230B301008000407110000
0711011122611415050638220514023D00100205030202021402030F29150302
050106010E391200090806080800000F2902020D012C28010F0620432493442E
032A1D0308000562040315140200000612130A1800050C1601010B0101010400
05000719432E441A1A5B241A020B090878084201001F0C0E0C0E2D0400040004
160401063C032202150D03040202060502000302020D00000406090511030600
030701410B011304390504080C050B05050203024105001601022E0203110601
01030404012904111800130402204A2C0F020D050284050D19251B0007060600
060707180E0B10011D012A43431D18140F640000000800180B01000104000520
00030245020D03020005070D20140402010B02000D2502042500250106070000
030600000107010801150223120B00030F02020707000801100C0E1601084500
030304380764013108001B000B2F2E511A24601A1A5B1A211A21373601060101
0001160B31010C130801070B0C00091463020000000B114C0101041600410206
0D0301141922020700011102000D042505001502031B14000304060D660E0403
0006000B0C3101010D060006070004010D01001B04040C0E0C100E0000050716
042A3B070C0C09011F2237272B21271C212751241C212124211A2B214305040D
03030B0C5F320E010C0108110B04012F36376807110900000C09000F00090705
030E0814020202060D03290405050500000506060503050D19060D00042A0708
0405040601010908130F040D000D000609040400160108010B070101092F0101
090B110611090900191C1A1C1C401C402E362F2E732E271A1A21212B1A2B3622
0F001217100A00141A1A43140E07010000040025290B010100070111070D0400
0D0041150D03000D15020402030607011606005900000106150F010706000900
03090307070B0E0C010404030302090507060708010D14040004010700110700
07080F010808014424211C2B022F0222041E0E08001601001D02241C21211C24
360D0A0C7C0D2F6051212B1C1A19000D04040709053700120001060B080B0903
06020403030F06000300021D8B0D06070101031205010006030449040D2A0000
0B000404091D01000531000302010B080C4C010007190302110501134C050901
1D181B0B0C012E1C1A41220D020200000408070C12050B1D0000431C2B1A481A
2124490A12244308141A2721270D02060603010000514400051347180A0E0C01
2A011903023E0D0D0215030207110B001104020203030204070D060D01040705
0B01000B010C0E06000009000239305E0B0007010943010403220D3509221D03
032501060244241902000900000F0D05192451241A271C1C1C1A1C481A211C1C
1A1C1A012F2468051327241A0704040403380201202E27070001070101130106
0802030003000202030303050101080400050203040202000F02250605020500
000103000F0108020D0D1809251208091D1B0704181C0706070002060720032F
0215001937190905060508000D0F3A2B481A24211C481C40481C21691A1C1C1A
241A24246824376E0C20432E00140005040B010B001A21160E000A08090B010E
0B040300000D020D0000030F1600051D02030202060304070504050029020400
2A05070D0B011103000600080618100E06000C050027271912130004350D1536
4419515D051618060800091602212727276E0300250214191514192724378627
211C2B2421211A1C371311000B0F03021B1100070524029904025E010001180C
0D0904000603060202000D05260000050000150003020000030400040D020106
0D11000107080003020100502D320C002807006207961C1C2E2505140F031433
2F6E2201120105060D03010107031504011301052D06003A0D03000006064908
043721211A1A2127212E43221303142F01000D372724011B090101010B0C0B01
0805010D00410206140000000D2902000300060303040D0D0400000600000013
000704040B040B121F08040B100100010812160008012F46482B275D22026284
020600050800001D1100000900000111060D091100150400130639014319540D
35431A211C2B5B1A212424200004040D2F2E1A1A19202600010B1617070B0100
110516000F030F0D04040001001B040B040902066107060D0D04032C00041103
0100090F0001000900110B00090003180B08003118010B0636212B1C1C371933
1D05060500071304162607000916390200060219222E2003881A211A1A516024
241A1C1A211A1A1C1A211A1A940206142E37364302050B0B0B0907090E080701
1301110002010302040226000D390305060D0D03450411030603130700010304
0900000007061B2C090409080C0C08060B2D090100710901050D192E27211C2F
00070007070E050001010407080E0B021D0406194637372E37372E2E2E54442E
2B211A1C211C2B242B1A1C1C21211A790B353E02050C080707490C0A231F1230
0B01070D0407000603003403020606060507140300030000110C071100130900
070118060704381104000005010801071E3E091600260B01074207072F193600
081F04000107001116000012011F1215050D00070005080711010C010E030303
2F19222F27212B24002E24242427211A200E160012130C12080E0A0E12120C28
110504030500000D130000150005040202000300040F0708080E130008110100
2C110B0426020300060D06060E0E080E17086B1107070007052C000B0B1D0005
000705000000005208260F010B01060D06092834090F072036544436602B2127
2B1C1935092424242F000120242B1C1A1A020D00070B0507260E0A080B0B0B0E
0600390005070103000002070B07040204250D07060D01124C0D040B0E000E12
061304010D11010D0D03250E0E0B010B01120809120201010000050807004C38
0500070F000D091F3412040000010B0800001E080205160000034324192E225D
271A1C1A242E2E246809180B112F271A212106000900030030091F3001010305
0D040504050503070D010204200000000D001D04020005060B04091800010726
11000B010301010203002A020301180C45070C070E04061B1603040D0004052C
060D01021503031D070B280F06002C011B0801000F050514332044364D190302
540505432121692B1A2F023624290D1A272103110B0D0104120E120104380302
020300250029010603040D050600070200030901190D060F0E0707070108115A
0E322601030604060003030200070B070008230018083B080001290B090B0008
010301032E1A2F00001166010207052E1A242E2E1A1C271C482B1A5D27631C1A
2027511919372B2121462E245B240B191A24010004390F0400041300000D0000
060D000D111D3C060038290203030D02030F01040603040F01090C1F0C010809
04000B000D0213032F1406020B050D0007080005078E01180C03150D00000003
2F1A1A1A443A00290505001D362F2F2F35142F1519200322200D2502192E7021
2B1A21371C37432740401C27245D000724010C0010000B080206043C000F0202
02000D0300000600040502053A050700420007070007081201080132080E2600
00000108051901020203050304160304051F0113120B0B00030D00080936211C
212E433C0700490C5A002F5420190322032019222214202F460222452F030005
0F22542E37271C372744241A24437751050713010B0804010D02020205030D00
06032A060506040329040404020D01000111010B010109120004010E0C010009
0118070905420D390503150026010007020B000B0005070D05071B052421242E
050105052E1A2B2427242121211A1A1C2B402B211C1C1A1C2B401C1A271A271A
27242E031402152F6E37032E462E2444122D100E1213010804030F4102042904
0000350D0012050002200304020000000B000B040501000307320C090E000B0C
0B0908011D002F070303020116030C010D0008010B0316060100441A1C190705
09034021401C1C2B481C211A27481C241A1A2B48691C2B1A21481A212B1C2B1C
1C2B1C481C371502142B2704031107080B0B12100701040D0D02150406030103
060F0202030F0005050F02290600072A16030901011D0011070E230B1B09090B
00080C1D030D020F0F030F0D18040B05020708070B0B07010B075421361D0502
06072054461C1A1C241A1A211A5B1A2127241C4069401C242727211C271C2B27
1C2B1C46360202030502212E1300000701000C3B0900130D140203030501030F
0400060203050B0006020D0205010D0F01001B0104010A0209081304000B0C12
0300032000081201000501020F020F0002200D140206190314192F244D220303
0B0107050000010502022E46245D27372E19372E464336362E192E462E2F0326
000009130B0002021B034424010411010004000D050503040506040B2C04080B
1023100C320C0A0E18090C08282D1F0B1E0B000104260500000D000159002D00
0D0201041D2A0302050603030D050306050D19020220140319021446271C3619
0065080F0506040F030279033D051500000F04043F39052634090708000D0836
030009010004003A2B212E111D070705130D390202150500050404160300090C
30300C0B2D090C230C1F1F0A0A1E04070E09090B000406022006070B1F015F0B
00010B061414050202050303021402030701011936333A330319190D191A1C2B
2E5102292C0101050115061325020302040202000012061806081F11002E0D12
06030D252024271C1C2B020213010004290D0504020300020106010B00050F01
000C18083E2D180B0908101E0E08090C00070B090507000829000C0109070401
0107410D000403020219141902201519041207030F192F140302150606153337
212B212B24360302021D0B2A06020304060F030E00070F0200230B0300022268
27372B211C911A331902021100001B0D0D020701010F050F0D06000804060013
0E120016120C16105308080B4A0A0A0C01070E2611043C120E0E0B4F10530211
00002500002A1B0014023D02021402030D0314023A2002203A0F014713380052
3C034444442B1C1C4320340346450F35040100000D060D050D19192E2B481C48
401C2727463D0306042F050F020D0F0301008A000B0904250626001801080100
070B1212110B183018081F501F0A1E080E0E11130911081308000B0C0E3B0B0C
290F25020202020105040322020314200602022020143F06190305002D0C0A23
080913070F0E02030D3744040F362F19051B0422362E1A271C1A2B461A273702
191920030403050322020D0202203D040301012600010404041D00060D010004
0C100A01050001070B1847100E1F1F0809010126040B305F1600011B0D090B0B
120800011B063A050D070D1B05030007000525060202203C08010909450E0C0F
0C01085C2C0301010300051602030305220211022E19023503220F010D04190D
1405051525020002020F02030503020F02110304000005030411041107070B01
0B0E09070F01090B0705000C180808120008311F050B0C080C010406064C470E
0F2009070325030D250B050305032A05020702022506140205012D4B051B0101
0E000D060F0206050D02030303020F001900000004060D040001031102050306
023F0F0F0F03030D0F0D0F020215140D030106060D0302000500000B13110801
1B08180800230C0C4A580C5A0107070C28010C163101080104001D0C2D4B0F14
1B0F021D14150305030503030304020213000F022F2002030202060612002000
04000100050D05020503022A250219004619040605060D0D0D06360352200F02
15150038030D000304020D0503030D0615040605140D04020500082D07081208
0B120808110C23091E1E0C23100B070C18090B0C090812110F0D0E0132050E02
021D150F021920033D0D03050503030239000505023A07062202100912040603
001201070000043F04030F1105001919541C730303040F030601420605000000
043A02140206040920060D0606062C020303060200070F000D00344E0928010E
0807122A01005310084E0C1F302D0C1F230B112A0112050B01041D050D000102
04030B0F030329023F031419191403020503001302220202020001230B060011
0712050B0D0605110D06030305192F02441C2705140006032004000300030901
07140502022A000006050D000405140206000206000001000005000C0B1E0C01
05000801070C0A10310E0B0B18300E0C0C23070B0901000412030F0902041402
00390F1D0E0F0002032F0D14201414140202021B1B141919030005050000160B
000F03023803080203350205050203022E21271A010F0D041300040036150113
0401080206060011000315002C030202020304380309060712130E090B120B08
0801083E761001230C1F080901101228011600090C040001000F11080C000005
053D031D05050D0302070F0F152F15050422020200030F2C0200040407000901
0708000701010800060F3A201425020F021A2B402E0D08040800000219011601
0F1D031501110016021B0202040F0219040401060F020102050100010B071B08
3E0908120B0A160723042A0B080B120001010C080E00071B08005A3E0C180106
0406040F020D0F030502192F15220F2F0D0D0F151D143501030B010600162309
08473E09130100010A0E0925020D14030D02461C404400000506010405360D03
0F000D150D07090100060406000204030300010008040D0F00000B080E0B0801
120A010C1810010B08081301040816080E090A0C31010108010013820B010F02
060D130502002535060F150D030F031502050020152201110900010D30281612
070B1309054F4E015C1B151B0420540D35190D1A1C2B2F070401000400020506
02060422060109001002020F1915030606050002110505000001110112070C28
0C0E0A0C18010C0B0C120B01120A0A5323080C18084F08261208180B05050602
0D0306030D0020200402022515030202350606000D4C121D00180907300E1201
1D006A07010B040D053C030503040F2005040019272B3604000F010D00130002
000108341302050B0002140213130D0D150006010607090C10010709260C0C12
0B10100101070B090E01083010320A1F30550B0C180E111605010E010705001B
02010503060C062C060E453D2F330F1415020018092A150000092D0C2A120700
01010A1132010506030D0235050315060F1B0F0327482E0403030F000214153D
02020D161106040D040002090F0402030F05000D1D0001282D110807300C5E08
0A083400073C081B040B0C1F0B0C1F1F0E320C0E07100B0102060622051D0616
000203055C0B071207130114333D0502023305032006000C0907090C00081612
01030E0718060202003B03773A19200D3C050F37212B1100130002000000033A
03000B1103050000031302030103020406020442040901504A0C07010B120400
070B090109070C08310C0C1210080908010B0C3200010C3B0202121B090C3E12
180F19020507180909000D190206000202021402061B060001260607090D0203
010307090500020103031D041503140204033740270F03020F0200110D02050F
050600050004120F000015021522060220020300011D0D1D280E0B311201286D
0B0600070C0C08180B0B09000E0B1207000C0B000B090702040406021D070726
500503220D050F0012000D1414021B00062003030100004509010B121B074504
0D081B07094122061B141419351402060537212B190404002C13110604011502
0204050200030F2A0D03040403040D0F14001111100413090C4F32104C083408
080400070C3010100C1E0C0B160807000930050E096500010C0703050F040500
22140F1402020305050706040B060F330214020700191520030222201B000702
05000F070B0100032002020305222A05191C1A15251D02060501092A0403006C
04132A0200040006130003110F0014381402021B061E4E0823230C23010B0801
000B320E10280C0A0C081E100B0C2816001B281B09040301010B050600030306
0D030300000006160101012C080B04381902020F2A0302002A030D061933160F
060005091E08080001030903040605002E210300040202450D04056C04003D26
1101000D0001090003050402030F03023A030308014E0A100C181F080B090811
00010B0C08300C1F1F08580C18080B0E0901160C1200030400020F03031D0005
030B0000640704121D03070B00002C0614022005090F06051420022902290403
020202180C1009520114012F050203062E19090E006504030214061105020405
060B004500010B120009010000120202151404231D0E23320C0C5F0C0C010008
32091028011F1F2309120B010B09041F0C160E100907024212051D0513090500
01090007000205180F0D081B090F0E07023A2502030425010300000102252502
0F22052916300500070489143A1611051A03020E2300021933190004042A0F00
0E010B0007000900000D090B07000F000200021E0F850B0E0C01080701000912
0C09970E320C0807002C000B0C551010170C08100B04000B0B04000F00050118
180602001114001216000A1F320C0F0D0F020F0D1801060F0203001D03052806
0F2A000B12130412120D3F022C070D25400202050D040D0606040500040F0D0D
000711000000010B0907000E311303060000070702060406031012061B0B0704
071107070B0E0C0B3403040E0C010C09120A180C0F311601050C080B06031B1D
00350D0003020B200C001F4E0A091505050303001B0F02063F0202021402020D
04000000010006030E030000120B03041A14030006140268020511020605020F
010101000C0900000701010D0105020D07090801160702030E08132C0F010204
3210092D18093E0B0113071F1008741F080C1232281101121301040403030503
0D0F03070D02001402490B473000090500042A06072C04140503000000060602
090304140203020606200F0007021D0321050D060F1422732F3F060F02020D00
0000000013110B01010113090B0B000018010B011201060008083E100F130601
0830080A0C0701080C01280A0E01110B0E0C01184A000D000B07010003050000
00011100000302040602010602260B38001D16062D0100060F02050D0B070110
0403001414383341020D07020203350D2B030004141433272F022C0002150206
02010904020626090001010B260F09230E160C1123070100120B101218070009
0B01550C0118090C00040B0001070013080B23090B1F2C1208100B0903040503
0303040005030400010206031947001D0815022A1206020D0203030701010830
090709020402141406030203020215051C0209040F15242E2C1912020F420209
0400030201041B0B2D13302D120B00050B0E0808320C080A09281F0C080C000B
0B340B0E0808300C0E010809083008120E080C320B0E080B1F0C001826070306
040B090B0B0E13050502030D3F020411060D001606001414021435120216080E
0812060D0F03151402151411020700062437051304002B1C3636020106030604
060F000D01040108080C234B50302C380F0B450E12490B0C120C1F1808083209
0007081F0E0C0C0026180C080C1228083E120E0001180E0A0B0426161D0F0713
0729060D030B00042907111D0D05022506220500030319040F0D0202140D1B01
043B3F02201D00034103012541000D031C211A2E06191927360204040011030D
0F040415000426095E1E0E23280C4A4508261200060B6607101008120C1F1804
0B0B010C081B010E07002C0001010B000808081125010B120B0E07052C310D05
0809090749000701070B03053A220D1B111589050300330315020F0000000900
3A1919030D0D351406060F0D0003020540401C1C2E2205064D36040B04010602
0302000215050B1801472C0C231F0509000108010818306A0B1212011830230B
28010707010C08280B060B00001231180C013E163208075A01072C0202010605
4B1F5F0005000101110320143D0202030002253D023D4B14253A200D03000B38
1415030F15220D0F00000703063D040919481C1A1C402E631A20040D03040004
03040F0D02022D13016D01070E2D042D0F110C08080A7A6A0C281F08010C491E
0C091667070C0E010A870E280B090C4E2308090C0E4F0E13100A311300031200
0000000B0405010703010603034101141108000F1404001120140F3C03150402
0D001B000F0D251402151535200405001519631A272B1C2B27147D040D030202
0F0F0D0B0206002D110104340711011203001104084F170C551F0810160C0C0A
0C1D0C1F32080C080C010B0B1211070A0B4B230B050C0A011F0E0C3B0011060D
000000000103030F0007010502061503051B000205030D000302350603060602
0D0F0004061D020435050206030104043C0009462B1A692B2714060D02020615
0D11030202063803020402000161070F920213010B094B0C090B0A4A12100C1F
4B0C0E3E09011801070900010C3E0B1609080A0A1E170A100A17080E0808010B
000800030105070B05092C0300111D020338200320220303020215150F020004
0002050D00020400060F030300260314141411062021272F2E00060F02030202
62023F000447020603000F01060404000402080810080B01182D0A4E08230C0A
10080C0C0A0A100A0A170A171E170A0A100A170A170A0A0A1E0A0A171E170A0A
100E0C0C000000090023830009085202452214221903022A0303040000023401
2A00110611010202031116042C0215020202000006040D040602040F14010202
0202080400072D09662600090E0C3100000C1210170A0409000B0E0110103010
0A0A0A171E170A1E170A100A0A0A1E170A170A1E0A100A170A170A0A0A0A100A
0A100A0A0C080C01090B1F08021E0102030202151402020302032F030D04093C
22152C040901012C0E010910000322030303383F0F022904060D061106030202
060F260B090F071F0107010E12080C0A0C0013300C08040F0E10171E170A0A0A
170A1E0A0A0A170A0A0A0A171E170A0A0A0A080C300C0C12010E2D0C0C0A0A0A
170A0A170A1E0A10170C301304120005141D002202140202142202022F2A0506
38022A00093A31011E131F470F150204070F01091205382C006C020F150F3F0F
11040B0C00132C0001011B0C0901300C1F12550C760108170A0A0A0A0A0A100E
2D0C17080B0E0C010C0C1601280C09160812281809010B0B04060B01014A090B
090E171E100A170A0A0A0A0C130F033806200202091638031520151514141914
22030312053474080C1E160C000502223515000B0007060008040D0605020202
020600053B0B01090107001F4A0E0C0A160C0C5E0C0C100A0A100E3004171308
010500080013080718011D06110C0804010C08070B0701130713040801474C09
530C091605000E0910080A4A230F150412060412060113090F00020202060F02
0D1100006D2D184F0B0105110214043A0F000C0102060E131209020F01040200
0D05000B4A8226010200050E0603124A757A0B7C100C0E290007083104110704
01072818000B1F4716130E040700121E280B0A0A0A100C011F1800060011000D
300A2823080100010B120C1F092235330213000F120D011B00000214095C1259
000302310E31120A450F04091D020D410004160414110D03340D06110000060C
0013340C0A1E01001514012C01011F0B0A4F171F01010115054703160007090B
051213002D0A4B010C090C101010170C100A171E170A1E0A10081301130E0501
07161F7E58162C06060C072D0704044D634D0D0F050F00000001652C0D0F0406
00132D123B010F1E000216070F001605020312040F05010001070F135C07001B
0E0B00001809120906040D011B1B2812178F7C0E020D02170E300B0804010800
18090007070C100E100A171E170A1E0A0A0A0A0A0A0A0A170A1E0A282600020D
00235E556B0A12160909050C1209131102194D020B051402330D00113F06132A
010E1E316F0A6F0C02007B01610923010F053B0400130F000402110401060006
0E100B00000E0701080305090308094B08554F080006190C0118081828081001
000C160B1E0A170A0A170A0A0A0A0A100A1708171010100A0A170A100C081300
09100A7E830A1E0A0A10100C080909091204030F1013060203030204013B0300
0F012D103B2D1234030F042C0E0F001234030105110409040301080909121608
0C10122C000009092A040142090B2310130C0C160A09010E031B16100C180E08
0C011F100A171E17101F1E0801080C180C10010D05081F0A100A0A0A171E0C08
0142100C0A100A100A0A0A0A100B0B261D00020D02011711020606020D000126
010D00120900021B2C0304220F0D1B130006112900030404001E01071109080B
1201060512111106030141010113090116100C0E0901000B0F110B0E0C01093E
180C100A0A0A0C23080800000D07010E090C08000B0E180C0A0A100A0A0A100A
090B1E0A100A10090A170A10120109591D00050302011708110404040F220200
0003020005000215070104042A0229000015000504000200050E000411070E00
09131B01340012060304080009083230670C010E16130E07000008070C160009
100A0A17080B260B120001010047090930010A170A100A0A1E170A100A170A1E
1701170A0A170C08100A170C1304490B010B000100060A0A0D04131B020D0205
050F0000060E00060320020061040D0C08000F1D01021506092504112C100C00
0C0C03000001030602010101000A0C1F100C0808041D09330001230818070209
170C0B010B010C08130105040C100A171E170A0A0A0A0A170A0A0A0A100A170A
0A100A170A1E1701100E0E16050642000100053201000A0A03040100060F0203
0504000013030402021406090909111111013C020604000203420B5602670900
08070E04010E030100040000010A4F0C1010470C130E0600020B070701194D3D
0E010716070E080811110E170A0A0A0A0A0A002613000926082D0C100A0A1E17
0A0A100A100A170A09080D0001090900070905030E080A090600110403030211
0000042A0504390F06150908002D01060400000602040302010D005600010812
091864040E010112011B08070B10170C0C080F080C0204020D0203024D4D0601
07070E18011612004D4D08100C0C010701090F0F00040D03000500000100081F
100A0A0A0A171E0A0C100E290704032001080609170A17110F0206110F0F1520
051202060F0F0404150C0781011818010B0C06040D0D0F0F2A090C0E006B0409
0202050B3C070004050701011010170A0C0B041B0F00010003021D020D080D08
05660801010100033333010400000D05080000030F0107110411090908080E09
0A0A171E170A0A100A170C000200020508080C0A0A0B01070104000600040F14
14000D0400000204060F041104080C160B0C001533141326060001083B110F11
0902003C03060D250101040F10100A0A0A1017080800070B070D010B0C07070A
0B3E010006000D023500290506070000000B0000070E10100C100A100A171E17
0A100A171E0A170A171E0A0C090005080A0A1E0A01140D0102070E040F070002
1502590400090009095706010E311E1F1F0A0006140F0D030D14027B0406030D
0500050502040202030300050B104E170A0A0A0A0A10100C0E0016180C010118
00031D0D0205251414092A0707030704040B1E0A0A0A0A0A0A170A0A0A0A0A0A
0A0A0A0A170A0A0A1E170A1E170C0816000803110D1300073900000126000206
06152A0100182C0F080104500A342309014F0F0209133F140013000404033A04
52060D000002030F0202050302280E780A171F10170A0A0A1032053207030708
280E13060D030F040D250001070105080E10070B0B0008130909082C0401100C
0E0C0A100A171010170A0A170A0A1E100B000129123501120E12011304030F34
0000131600520004120A100E002600084A010916111D01020F00010107030300
12030F02000B04020402002D01000C1F100B01080E0C100A080108230E080001
0C0106000214022503020D07030D0001000004050001230009000E08080E080E
16080E0C0A0A0A0E0E010C0A0A0A170A0C0502200506000007010001005C0000
030D010E2A116511100E04070D310B2D3B16390701083400052202010000380F
000439191504004206090B10071606090C0C08001413000B0B00080701000700
0C0E072A020205050407250205030504020D03071008100A1E170A0A0A0A0A0A
0A0A0C0810100A10010104040C0A1E170A1000020F1B09000105120101040F0B
110F00040502000C0101005001130174501E020D0500010F060302162D01063C
15221B020203011113100110050E2810301F3E08010100070D2C01000B010700
041B290203000202030503039A06050006060505050709070801080B04080C10
0E10170A10171E17161609000C0C170A1E170901001B091B1304000200003407
0128120D000F06091300310E260F45261F5059020D0D0513413F05060D09010B
0D0106000F250206014F090E1628010F321E00234C04070C000C080B00000C00
06020F020F00032003000429070916030005080808100E0C0E09090909010901
01000C1E0A0A170A23080E080A0901170A0A01130104011102071313050B0D0D
011326131412340E01041801000156100E0E13010603020100050E0604010307
01230F0D0C3C0B12280C7528010B5A1F0A12161800070B1F07230A160B070701
0115030503353C2503030401030D010700080A0A170A0A17100A10100A100E30
17090C0C17100A1E170C0A0A0A0C09090A1709000D000203031D000D00020215
0213800902153A230604020C0801231208010D05000222020541040714082302
410C030E050F0E1823091101090E0101070108000116120C00000C0C31080C0A
08160000000F061B09090B100A171E170A0A0B000E01000C0000010C100C1010
0A100E0A090C170A0A0A0A170A0E09040A2301000007050904001D2A00000003
0200000001000B040D09560072560009010039023F13152F1406040202020100
14050F007B02081B0316111E000B010C100C100008095A000C10170A170A0C07
0818120703050307010B090109123E00000009080B09080E0E010804030F0300
0E0C08080A0A10170C100A0A100C170A000305110608010000000F0304051100
04040001110F04030F01231E0012014772083B26040502030400420615190000
0F000435110402020401040B0E16080010230C010B090E0A0A0A0C0A23080B0B
011B132A0309090701080C0809080E090B09170A100A171E170A10100C100C10
0C09000108000E004D0B0E10080E100C6200062C090108280001111309152908
06000E0B6D00020206030F01520401101104080E090F0015790F050102200220
0D16021529020D0205091307160E010A0C0B3E0407100A1710080E0307080C10
1017100C10170A100A171E170A100A171E170A0A0A0A0A0A0A0A0A0A0A0A0A0A
0A0A0A0A080001154670000215150000000C010E05080C0E100908111B000C3B
044907042D121103020506011300090911090016043942000025020405061415
5900030205090F14155E01010101090007090B0E0A0A0C08300C020B0A0A0A0A
0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A}
Visible = False
end
object btnClose: TButton
Left = 300
Top = 10
Width = 93
Height = 31
Caption = '关 闭'
TabOrder = 0
OnClick = btnCloseClick
end
object btnPreview: TButton
Left = 113
Top = 10
Width = 93
Height = 31
Caption = '打印预览'
TabOrder = 1
OnClick = btnPreviewClick
end
object btnPrint: TButton
Left = 207
Top = 10
Width = 92
Height = 31
Caption = '打 印'
TabOrder = 2
OnClick = btnPrintClick
end
object btnPrintSet: TButton
Left = 20
Top = 10
Width = 92
Height = 31
Caption = '设 置'
TabOrder = 3
OnClick = btnPrintSetClick
end
object Button1: TButton
Left = 758
Top = 15
Width = 92
Height = 31
Caption = 'Button1'
TabOrder = 4
OnClick = Button1Click
end
end
object pnl: TPanel
Left = 0
Top = 50
Width = 792
Height = 411
Align = alClient
BevelOuter = bvNone
Color = clBlack
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -15
Font.Name = '宋体'
Font.Style = []
ParentFont = False
TabOrder = 1
object StatusBar1: TStatusBar
Left = 0
Top = 392
Width = 792
Height = 19
Panels = <>
SimplePanel = False
end
end
object PrinterSetupDialog1: TPrinterSetupDialog
Left = 364
Top = 52
end
end
//////////////////////////////////////////////////////
测试代码
//////////////////////////////////////////////////////
unit PrintPreview;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
printers, ExtCtrls, PreviewPanel, StdCtrls, ComCtrls;
type
TfmPreview = class(TForm)
pnlTop: TPanel;
pnl: TPanel;
btnClose: TButton;
Image1: TImage;
StatusBar1: TStatusBar;
btnPreview: TButton;
btnPrint: TButton;
PrinterSetupDialog1: TPrinterSetupDialog;
btnPrintSet: TButton;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure btnCloseClick(Sender: TObject);
procedure btnPreviewClick(Sender: TObject);
procedure btnPrintClick(Sender: TObject);
procedure btnPrintSetClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
FPv: TPreviewPanel;
procedure Draw;
{ Private declarations }
public
{ Public declarations }
end;
var
fmPreview: TfmPreview;
implementation
uses
UnitTest;
{$R *.DFM}
procedure TfmPreview.FormCreate(Sender: TObject);
begin
frPreview := TfrPreview.Create(Self);
pnl.Align := alClient;
frPreview.Parent := pnl;
frPreview.Align := alClient;
FPv := TPreviewPanel.Create(Self);
FPv.Parent := frPreview;
FPv.StatusBar := StatusBar1;
FPv.Margin := Rect(1,1,1,1);
FPv.Columns := 2;
FPv.PageCount := 2;
frPreview.Show;
end;
procedure TfmPreview.Draw;
var I: Integer;
begin
try
FPv.LineSpace := 0.5;
FPv.ResetPos;
FPv.AddSpaceLine(2);
for I := 0 to 20do
begin
FPv.AddText(' 撒赖打开sfdg飞机了;按时b地方看见方看见撒赖打开g飞机了;按时b地方看见撒赖打开g飞机了;按时b地方看见撒赖打开g飞机了;按时b地方看见撒赖打开g飞机了;按时b地方看见撒赖打开g机了;按时b地方看见撒赖打开g飞机了;按时b地方看见撒赖打开g机了;按时b地方' + IntToStr(I));
//if ((I = 4) or (I = 2)) and Assigned(Image1.Picture.Bitmap) then
// FPv.AddPicture(Image1.Picture.Bitmap);
end;
Caption := IntToStr(printer.Canvas.Font.Height) + ':'
+ IntToStr(Canvas.Font.Height);
except
end;
//FPv.Left := (FPv.Parent.Width - FPv.Width) div 2;
end;
procedure TfmPreview.btnCloseClick(Sender: TObject);
begin
Close;
end;
procedure TfmPreview.btnPreviewClick(Sender: TObject);
begin
FPv.OnPaint := Draw;
FPv.Preview;
end;
procedure TfmPreview.btnPrintClick(Sender: TObject);
begin
FPv.Print;
end;
procedure TfmPreview.btnPrintSetClick(Sender: TObject);
begin
if PrinterSetupDialog1.Execute then
begin
caption := inttostr(Printer.Pagewidth) + ':' + Inttostr(Printer.PageHeight);
end;
end;
procedure TfmPreview.Button1Click(Sender: TObject);
begin
button1.Caption := inttostr(sizeof(variant));
end;
end.
////////////////////////////////////////////////////////////////////////////
调整屏幕“A4页面”的高宽使其能显示同打印机一样的字数,我的方法可行吗?你能提
出更好的解决办法吗?
现在我把代码贴出来(已经改得很乱了,请不要扔砖头,请多见谅)
有兴趣的富翁帮我改一改,先在此谢过!
/////////////////////////////////////////////////////////////////////////////
打印部分
/////////////////////////////////////////////////////////////////////////////
{
2001.6 王珍义
}
unit PreviewPanel;
interface
uses
Windows, Sysutils, Classes, Printers, Graphics, Controls, Dialogs, Extctrls,
Comctrls, Math, Forms;
type
TMargin = TRect;
TPaintProc = procedure of Object;
TPrinterState = (psPrint, psPreview, psIdle);
TSize = TPoint;
TPreviewPanel = class(TPanel)
private
FBmpRateX: Single;
FBmpRateY: Single;
FCanvas: TCanvas;
FCurrColumnX: Integer;
//pixels
FColumns: Integer;
FColumnWidth: Integer;
//单行文本宽
FContentHeight: Integer;
FCurrPoint: TPoint;
FLineHeight: Integer;
ForgMargin: TMargin;
FMargin: TMargin;//cm
FOnPaint: TPaintProc;
FOrgPoint: TPoint;
FPrinterState: TPrinterState;
FPageNo: Integer;
FPageSize: TSize;//Point
FRateX: Single;
FRateY: Single;
FWRate: Single;
//打印机字符宽度与屏幕字符宽度比率
FHRate: Single;
//打印机字符高度与屏幕字符高度比率
FStatusBar: TStatusBar;
FPageCount: Integer;
FLineSpace: Single;
procedure AdjParms;
procedure ChangePage;
procedure ChangeColumn;
procedure ChangeLine;
function CmToPixels(cm: Integer): TPoint;
procedure SetColumns(const Value: Integer);
procedure SetMargin(const Value: TMargin);
procedure SetCurrPoint(const Value: TPoint);
procedure AdjustLineWidth;
procedure SetPageSize(const Value: TSize);
procedure SetStatusBar(const Value: TStatusBar);
procedure SetPageCount(const Value: Integer);
procedure SetLineSpace(const Value: Single);
public
constructor Create(Owner: TComponent);
override;
property OrgPoint: TPoint read FOrgPoint write FOrgPoint;
property ContentHeight: Integer read FContentHeight;
property ColumnWidth: Integer read FColumnWidth;
property CurrPoint: TPoint read FCurrPoint write SetCurrPoint;
property LineSpace: Single read FLineSpace write SetLineSpace;//以行高为单位
property PageSize: TSize read FPageSize write SetPageSize;
property PrinterState: TPrinterState read FPrinterState;
property PageNo: Integer read FPageNo default 1;
procedure Paint;
override;
procedure AddText(Str: string);
procedure AddPicture(Bmp: TBitmap);
procedure AddSpaceLine(Count: Integer);
procedure Print;
procedure Preview;
procedure ResetPos;
destructor Destroy;
override;
published
property Columns: Integer read FColumns write SetColumns default 1;
property Margin: TMargin read FMargin write SetMargin;
//以厘米为单位
property PageCount: Integer read FPageCount write SetPageCount default 1;
property StatusBar: TStatusBar read FStatusBar write SetStatusBar;
property OnPaint:TPaintProc read FOnPaint write FOnPaint;
end;
const
cmpI = 2.54;//每英寸2.45厘米 ??????????
implementation
{ TPreviewPanel }
procedure TPreviewPanel.AddPicture(Bmp: TBitmap);
var
bmpW, bmpH: Integer;
begin
try
if FPrinterState = psPrint then
begin
bmpW := Round((Bmp.Width) * FBmpRateX);
bmpH := Round((Bmp.Height) * FBmpRateY);
end else
begin
bmpW := Round(Bmp.Width);
bmpH := Round(Bmp.Height);
end;
if (FColumnWidth < bmpW) and Assigned(FStatusBar) then
FStatusBar.SimpleText := ('列宽不足以容纳图形');
if (FContentHeight < bmpH) and Assigned(FStatusBar) then
FStatusBar.SimpleText := '页高不足以容纳图形';
if (bmpH - FLineHeight) >
FPageSize.y * FPageNo - FCanvas.PenPos.y - FMargin.Bottom then
ChangeColumn;
if (FCanvas.PenPos.x < FOrgPoint.x) or (FCanvas.PenPos.y < FOrgPoint.y) then
CurrPoint := Point(FOrgPoint.x, FOrgPoint.y);
FCanvas.StretchDraw(Rect(FCurrPoint.x, FCurrPoint.y,
FCurrPoint.x + bmpW, FCurrPoint.y + bmpH), bmp);
if FPrinterState = psPreview then
CurrPoint :=Point(FCurrColumnX,
FCurrPoint.y + Ceil(Bmp.Height / FLineHeight) * FLineHeight)
else
if FPrinterState = psPrint then
CurrPoint :=Point(FCurrColumnX,
FCurrPoint.y + Ceil(Bmp.Height / FLineHeight * FBmpRateY) * FLineHeight);
except
end;
end;
procedure TPreviewPanel.AddSpaceLine(Count: Integer);
begin
CurrPoint := Point(FCurrPoint.x, FCurrPoint.y + FLineHeight * Count);
end;
procedure TPreviewPanel.AddText(Str: string);
var
I, J, W: Integer;
tmpStr, tmpStr1: string;
WStr, WStr1: WideString;
begin
tmpStr := '';
WStr := Str;
for I := 1 to Length(WStr)do
begin
tmpStr := tmpStr + WStr;
{ W := Canvas.TextWidth(tmpStr);
if W >= FColumnWidth then
begin
FCanvas.TextOut(Canvas.PenPos.x, Canvas.PenPos.y, tmpStr);
tmpStr := '';
ChangeLine;//CurrPoint := Point(FCanvas.PenPos.x + 20, FCanvas.PenPos.y);
end;
}
///////////////////// ???????????????????
W := Printer.Canvas.TextWidth(tmpStr);
if W >= FColumnWidth * FRateX then
begin
if FPrinterState = psPrint then
FCanvas.TextOut(FCanvas.PenPos.x, FCanvas.PenPos.y, tmpStr)
else
begin
WStr1 := tmpStr;
W := 0;
J := 1;
tmpStr1 := '';
while W < FColumnWidthdo
begin
tmpStr1 := tmpStr1 + WStr1[J];
W := Canvas.TextWidth(tmpStr1);
Inc(J);
end;
FCanvas.TextOut(FCanvas.PenPos.x, FCanvas.PenPos.y, tmpStr1);
ChangeLine;
end;
tmpStr1 := '';
tmpStr := '';
end;
////////////////////////
end;
if tmpStr <> '' then
begin
FCanvas.TextOut(FCanvas.PenPos.x, FCanvas.PenPos.y, tmpStr);
tmpStr := '';
ChangeLine;
end;
end;
procedure TPreviewPanel.AdjustLineWidth;
begin
FColumnWidth := Round((FPageSize.x div Columns - Round((FMargin.Right + FMargin.Left))) * FWRate);
if FColumnWidth > 20000 then
raise Exception.Create('列宽调试错误!');
FContentHeight := FPageSize.y - Round((FMargin.Top + FMargin.Bottom));
end;
constructor TPreviewPanel.Create(Owner: TComponent);
var
ppIs: Integer;
begin
Inherited;
FLineSpace := 0.5;
FCanvas := Canvas;
FPrinterState := psIdle;
FColumns := 1;
FPageCount := 1;
FColumnWidth := Width;
FCurrColumnX := 0;
FCanvas.Font.Name := '宋体';
FCanvas.Font.Size := 9;
ppIs := Canvas.Font.PixelsPerInch;
if Printer.PrinterIndex >= 0 then
begin
FRateX := GetDeviceCaps(Printer.Handle, LOGPIXELSX) / ppIs;
FRateY := GetDeviceCaps(Printer.Handle, LOGPIXELSY) / ppIs;
end else
begin
FRateX := 6.25;
FRateY := FrateX;
end;
FBmpRateX := FRateX;
FBmpRateY := FRateY;
FWRate := 1;
FHRate := 1;
end;
destructor TPreviewPanel.Destroy;
begin
inherited;
end;
procedure TPreviewPanel.Paint;
var
I: Integer;
begin
inherited;
if Printer.PrinterIndex >= 0 then
PageSize := Point(Printer.PageWidth, Printer.PageHeight)
else
PageSize := Point(4362, 6414);
FCanvas.Pen.Color := clBlack;
FCanvas.Brush.Color := clWhite;
FLineHeight := Round((1 + FLineSpace) * FCanvas.TextHeight('用大田小永'));
FCanvas.FillRect(Rect(0, 0, Width, Height));
FOrgPoint := Point(FMargin.Left, FMargin.Right);
FCurrColumnX := FMargin.Left;
FPageNo := 1;
if FPrinterState = psIdle then
Exit;
if Assigned(FOnPaint) and (FPrinterState <> psIdle) then
begin
FOnPaint;
end;
for I := 2 to FPageCountdo
begin
Canvas.MoveTo(0, (I - 1) * FPageSize.y);
Canvas.LineTo(FPageSize.x, (I - 1) * FPageSize.y);
end;
end;
procedure TPreviewPanel.ResetPos;
begin
CurrPoint := FOrgPoint;
end;
procedure TPreviewPanel.SetColumns(const Value: Integer);
begin
FColumns := Value;
FContentHeight := FPageSize.y - (FMargin.Bottom + FMargin.Top);
AdjustLineWidth;
end;
procedure TPreviewPanel.ChangePage;
{var
FontSize: Integer;
}
begin
if FPrinterState = psIdle then
Exit;
// FontSize := FCanvas.Font.Size;
{ try
FCanvas.Font.Size := 7;
//FCanvas.MoveTo(FCurrColumnx, FCanvas.PenPos.y + FLineHeight);
FCanvas.TextOut(FCurrColumnX, FCanvas.PenPos.y + FLineHeight, '第' + IntToStr(FPageNo) + '页');
finally
FCanvas.Font.Size := FontSize;
end;
}
Inc(FPageNo);
if FPrinterState = psPrint then
begin
Printer.NewPage;
FCurrPoint := Point(FMargin.Left, FMargin.Top);
FCurrColumnX := FOrgPoint.x;
end else
begin
FOrgPoint := Point(FMargin.Left,
(FContentHeight + FMargin.Top + FMargin.Bottom) * (FPageNo - 1) + FMargin.Top);
FCurrPoint := FOrgPoint;
FCurrColumnX := FMargin.Left;
FCanvas.MoveTo(0, FCurrPoint.y - FMargin.Top);
//在页间画直线
FCanvas.LineTo(Width, FCurrPoint.y - FMargin.Top);
end;
CurrPoint := Point(FOrgPoint.x, FOrgPoint.y);
end;
procedure TPreviewPanel.SetCurrPoint(const Value: TPoint);
begin
FCurrPoint := Value;
if FCurrPoint.x < FMargin.Left then
FCurrPoint.x := FMargin.Left;
if FCurrPoint.y < FMargin.Top then
FCurrPoint.y := FMargin.Top;
if FCurrPoint.x >= FCurrColumnX + FColumnWidth then
ChangeLine
else
if FCurrPoint.y >= FOrgPoint.y + FContentHeight then
//换列
ChangeColumn
else
if FCurrPoint.x >= PageSize.x - FMargin.Right then
//换页
ChangePage;
FCanvas.MoveTo(FCurrPoint.x, FCurrPoint.y);
end;
procedure TPreviewPanel.SetMargin(const Value: TMargin);
begin
ForgMargin := Value;
FMargin.Left := CmToPixels(Value.Left).x;
FMargin.Top := CmToPixels(Value.Top).y;
FMargin.Right := CmToPixels(Value.Right).x;
FMargin.Bottom := CmToPixels(Value.Bottom).y;
AdjustLineWidth;
FOrgPoint := Point(FMargin.Left, FMargin.Top);
CurrPoint := Point(FMargin.Left, FMargin.Top);
FCurrColumnX := FOrgPoint.x;
end;
procedure TPreviewPanel.SetPageCount(const Value: Integer);
begin
FPageCount := Value;
end;
procedure TPreviewPanel.SetPageSize(const Value: TSize);
begin
FPageSize := Point(Round(Value.x / FRateX), Round(Value.y / FRateY));
AdjustLineWidth;
if FPrinterState <> psPrint then
begin
Width := FPageSize.x;
Height := FPageSize.y * FPageCount;
end;
end;
procedure TPreviewPanel.SetStatusBar(const Value: TStatusBar);
begin
FStatusBar := Value;
FStatusBar.SimplePanel := True;
end;
procedure TPreviewPanel.ChangeColumn;
begin
if FPrinterState = psIdle then
Exit;
FCurrColumnX := FCurrColumnX + FColumnWidth + FMargin.Right + FMargin.Left;
if FCurrPoint.x > 10000 then
Raise Exception.Create('调试出错!');
CurrPoint := Point(FCurrColumnX, PageSize.y * (FPageNo - 1) + FMargin.Top);
end;
procedure TPreviewPanel.ChangeLine;
begin
if FPrinterState = psIdle then
Exit;
CurrPoint := Point(FCurrColumnX, FCurrPoint.y + FLineHeight);
end;
procedure TPreviewPanel.Preview;
begin
FCanvas := Canvas;
FLineHeight := Round((1 + FLineSpace) * FCanvas.TextHeight('用大田小永'));
try
//SetMapMode(Printer.Canvas.Handle, MM_LOMETRIC);
FCanvas.Font.Size := 9;
FCanvas.Font.Name := '宋体';
FPrinterState := psPreview;
AdjParms;
Paint;
finally
end;
end;
procedure TPreviewPanel.Print;
var
oldSize: TSize;
oldMargin: TRect;
oldRateX, oldRateY: Single;
begin
if Printer.PrinterIndex < 0 then
begin
ShowMessage('未安装打印机!');
Exit;
end;
FCanvas := Printer.Canvas;
FLineHeight := Round((1 + FLineSpace) * FCanvas.TextHeight('用大田小永'));
oldMargin := FMargin;
oldSize := FPageSize;
oldRateX := FRateX;
oldRateY := FRateY;
Canvas.Lock;
try
Printer.begin
Doc;
// SetMapMode(Printer.Canvas.Handle, MM_LOMETRIC);
try
FPrinterState := psPrint;
FCanvas.Font.Size := 9;
FCanvas.Font.Name := '宋体';
FRateX := 1;
FRateY := 1;
PageSize := Point(Printer.PageWidth, Printer.PageHeight);
Margin := ForgMargin;
FPageNo := 1;
if Assigned(FOnPaint) and (FPrinterState <> psIdle) then
begin
FOnPaint;
end;
Printer.EndDoc;
// Printer.Abort;
except
Printer.Abort;
if Assigned(FStatusBar) then
FStatusBar.SimpleText := '打印出错!';
end;
finally
Canvas.Unlock;
FPrinterState := psPreview;
FCanvas := Canvas;
FRateX := oldRateX;
FRateY := oldRateY;
FMargin := oldMargin;
PageSize := oldSize;
Self.Update;
end;
end;
function TPreviewPanel.CmToPixels(cm: Integer): TPoint;
var
ppIs: Integer;
begin
ppIs := Canvas.Font.PixelsPerInch;
if (FPrinterState = psPreview) or (FPrinterState = psIdle) then
Result := Point(Round(cm / cmpI * ppIs), Round(cm / cmpI * ppIs))
else
if FPrinterState = psPrint then
Result := Point(Round(cm / cmpI * GetDeviceCaps(Printer.Handle, LOGPIXELSX)),
Round(cm / cmpI * GetDeviceCaps(Printer.Handle, LOGPIXELSY)));
end;
procedure TPreviewPanel.AdjParms;
begin
// FWRate := FRateX / (Printer.Canvas.TextWidth('用') / Canvas.TextWidth('用'));
FColumnWidth := Round(FColumnWidth * FWRate);
FPageSize.x := Round(FPageSize.x * FWRate);
FPageSize.y := Round(FPageSize.y * FHRate);
FMargin.Left := Round(FMargin.Left * FWRate);
FMargin.Top := Round(FMargin.Top* FHRate);
FMargin.Right := Round(FMargin.Right* FWRate);
FMargin.Bottom := Round(FMargin.Bottom * FHRate);
FOrgPoint := Point(FMargin.Left, FMargin.Right);
FContentHeight := FMargin.Bottom - FMargin.Top;
if FPrinterState = psPreview then
begin
//Width := Round(Width * FWRate);
//Height:= Round(Height* FHRate);
end;
//AdjustLineWidth;
end;
procedure TPreviewPanel.SetLineSpace(const Value: Single);
begin
FLineSpace := Value;
if Value > 4 then
FLineSpace := 4;
FLineHeight := Round((FLineSpace + 1) * FCanvas.TextHeight('用大田小永'));
end;
end.
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////
测试窗体
////////////////////////////////////////
object fmPreview: TfmPreview
Left = 154
Top = 178
Width = 800
Height = 493
Caption = '打印预览'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -14
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 120
TextHeight = 16
object pnlTop: TPanel
Left = 0
Top = 0
Width = 792
Height = 50
Align = alTop
BevelInner = bvLowered
TabOrder = 0
object Image1: TImage
Left = 428
Top = 60
Width = 130
Height = 130
IncrementalDisplay = True
Picture.Data = {
07544269746D6170A6420000424DA642000000000000A6020000280000008000
000080000000010008000000000000400000120B0000120B00009C0000009C00
00004A526B004A5A7300424A5A00424A63004A52630042526B004A4A63004A52
7300525A7B00525A73005A6B8C004A5A7B00526384004252630052637B004A4A
5A005A6384004A5A6B004A637B0052526B0042425200424A5200525273005A63
8C004A6384003942520029293900425A730021293100425273005A6B8400526B
8C00394A5A002129390042425A00526B840029314200424A6B00525A6B002931
39005A5A7B004A4A6B00425A6B0029293100525263005A637B0031394A003942
5A0052638C005A5A7300525A840039424A004A637300394A630039394A003131
42004A4A5200524A630042424A005263730042525A00394A52004A5A84004A42
520021212900395263004A525A00313952003142520039526B00313942004A6B
840021213100425A7B00636B8C004A6B8C004A527B00393942005A6B94005A73
94005A738C0029394200524A5A005A5A840039395200526B94005A6373006363
7B00636384005A526B0052527B002131390042637B0031314A00527394005273
8C0029314A005A5A6B00524A6B0031313900395A73005A526300426384006373
940031424A00212929004A638C005A5273004A425A00635A730029394A00636B
840031313100395273006B7B940042394A0063738C00637B9C006B7394003142
5A00526B7B00394A6B005A739C005A6B7B00636B9400424A4A0063739C005A7B
9C00527B9400426B84006B6B840052739C00424263004263730021314200635A
7B00314A6300425A63006B5A730052425A005A4A63004A738C00425A84005A7B
9400635273002921310052525A003931420029294200525A8C0039426300527B
A5006384A500395A7B00424A7300635A84000A0A170A0A0A0A0A0A0A0A0A0A0A
170C080A010F010B6A4D630215060D0B0E080C0C0808171F4E310C1304083401
0403150911000F040504061E090418130000280809090904003900020B000602
06002C02020000152C070C26012C11080E0100100A3205010B1816160C100C0A
0A0A0A0A0A0A0A0A0A0A100A0A1E0A0A0A0A0C100C0C0C0C100C171302010001
0105011808010109080070143113062600050809121601080E0A180A1312003B
001411160100110211190E2357260107060D00000E08180004090D1D011D0602
04061B050412020513000C0108071D0C0B1F09170A1300080B010B0508000B0E
18080000070C10100C100A0C1017100C100C060203150500060F000302140000
000103000D00130C4A0E020C572D0C010005080C0E28503B100A2313053B0912
2A0F020F050600030261090000010F083409000E060506021B3A0235042C2A18
090539141E010D0312020405140B00004B170901094D3301094C080108070001
0706023D0D020002000106020B0101022502050D020649001D01331405190203
250D0600080E170A0A0C121F0C0E0113060101045700105300010411002C0007
0200010009010B0F0E311E6426090406090E0009110F023F0600040F0204030D
04041209100E050F060D070F120401080101120E0E00040A0A0E08080712082A
063C1B0600060D1220261B0D0B00011D0904060025150206330202190304040D
09100C100A170A0C090B060604010E011114000E07162D100C01110F02011200
0404060000020D0E09080501120E171F09090004070F14150304090E13311129
0915010010010306110000090703010C010107130B01000C0A100A0A0C0C0813
0603060D05002816260300060607070E1B020300050625000F0B16000E4E4A0A
0A170A0A09000D0018080A10311056180107784A0D000112010139020F25110F
00130410000004071F0C00090B110B010D00040701121602022809230E260009
13390606010711026C340A3E0006125F31015201280E0306000C080E170A0A0A
0C090106040500050C09051D000603040206000B00090A0A0A170A4E1E0C0C0C
080E00061914030901090C0A0A3109122331230C09120E06055711020F020100
0111080D0118282D0025111100080B3B060C04010004060F0203000B020B110E
0C0D0309030D01130007010B002C2D01001F30113F9B900100180C102D000600
100E0C530C0711040200360D080C000106000A171E17170C010E010003190609
0F22020D020501002D0E560C0E2D130909120403021B08010F2A073C0D0D0F01
06041D02020601112A410B180C0E00098D0B06052608130202040D092C050901
2A020209040602010F1D3B0D070B0C0006000507010E13010010230C0B000604
3A040D26010900010031020316080E100C0E2A0000000100030319153A350D06
091331050703050512101E0C570C0100000000020F0F34000606090A06110B09
0E1E130004061607060406343406010C00023B000B1011010F15060211050700
0D060711042607110400140F03000E120412131213010C00180E0E13011D0D29
2C3F011303061300050B00030B0C121B080100000D0900052203140502050050
06050100150D0202001B040E090034011302130711000107040104132809263B
280C110701081000023306060B01001105051012091F26101604020D0F0D0434
080100063B0111131B040D02151D00000709040E0B1818090C160E0A0C010011
230913041101560F0F0100160E0B00000006010605032A1402031929000B2801
1D06040325001B05032002050101120E04018001090905000B0C090018725728
2D1F093C090E18130D06003C0501070D0113230C16090E0E00040429060B0D03
030004001206031326221403030285073B0712080B080804080A0C0C0C080001
0B11132A01091200001500080C0B060D090405153F0006030203020D25001202
14021902021D0229050214140D220302200412000113050C0E080700000E4B12
121303060B0E103B2C030018030704000E030E08002308101208000E040B1306
000D0000000931040000201503005911090E000C12090C00090C17340E120709
011B0406000000010E0902110A0A0002011B14220101090D0303060207000214
02003302050F3505042214250205023314141401010105010111011800000101
110445000018556F00020E091311001D02020008280E0A12080C31091602000D
0362040501013B0100010215000002000608870C07050708180E120712070B0B
29050D0D1201030214330601100A1007151420660703010302030D1415020305
20000203050014141903030D0D0500050302140D06072902070B011600072507
0708084B010B233E0102000B1F0404072A07000118260C07010B01032A3B0101
3806340F232D010D2A04071539080006092D080E0C010E07015301093907080E
04000D0505140401040009040C170A4F00031403030215000633330F00032202
290502030D250B07013A02071D0603010300041B023D144900000D07000B071F
0C0B125A090E6711000204000003053C00060D0000010C0E090D060606051326
020401040D00650D0503131B051312080007340C0B080C070E070907110E0B0C
08030000041502000D010526081E0A1710050202000329190214331419030207
000402030200023C0515021D1B07250D0006030307010302081005031B090B0C
081808090B2900071F010E260E0701000400000F1126000E0B04140300060D01
0259310000024203061101040909030504001601070B0707001B0C0701070C23
0B0008000F03023C040F06040001100A0A080E00250203031533140325190205
0B07000002020200002502140701033D150D2902020F0B000E005300310B0108
05161112002909131209090E1304110F0D05000B1E0C090B1106060301023802
0C01052603001502030109040C0D6F04000804010128120E00080801070C0B0B
0E01260006040006000402000203071E100A1700020202142002190205620202
0700010D0600000B050004040302291403020511050205130B4C7F0A0B090800
080420040705082609000001061B41021902041B0D160F120C0B0B0D11060402
0D230201061511020605010638040B0B01013905091307080B120C0B0E1F0C0A
01710E0F090101000D0D3C0602040D080A0A0A0025030314226C140507050503
0F08063F451B01280000061D02020009250029050F00000600010118571F2D01
3C061607014C121B08000B1212060D156B2D000D13060E07012C060461030406
00010F1213064200030F001105070B1307070100010412090108280E5A230A0B
0B0909010900000D000F000D02060004080A0C00131502020002050705060F07
021B02060D001104110B030301151502021415331405030103020513010B1829
001E2D1011070229050005030C3D14001101040707040000040B0E0708040600
000B050E0109040D0D04010613080B10120C0808070C0708080B0E0701124C0C
0911160B011300021504033D02053126100A0002030F06020103070503056402
111D00002A090B16060F0D3A3814223D1419030D0215220B101605010700010B
0C4B180C0F011D122905290214220008571E00040B0604060016040B01390005
000108008109010813282818085F23171F4E67300E0112010701580C0C2D0713
1D010101090E0000000002060211560A0A0C022C03042006000D050107060603
05010D08010B0026000F0638060F051D15023D1403060D0F1812050202030E07
2509163E0007070307000219141305124708080002140700040501060B060526
07010506582D0900131212070B3E0A582875670A0C07010113230C0810180101
06010D090D0D000D0301140D0300100A1007020505020F030305060704000429
060D0300000C010704040000040500000619030F2502030600390F1415250004
050011051D0B4B16000D03060002010E490E0403000D000400004908090D0303
001801000C0C09100711130C0E0908010A18320C010C01011207182308090807
011B1611000000004102030213100A1007150D0501022904020300070D000500
000613000000010504130B0009000D0B1D1809000345020202050B0107040300
2900010438140204020205020000073208090001001313041611000B11080931
0100090C0C2D5C0E000F07010C0710160C0C16120B1305070116013208010800
07071B0403020006031503140C0A10000F000F000D05000D02060F020D060001
1E1F00062A160105013404013911070706065C281B06060302193D050D030205
017106060008060F050007070F00040D1D3C07000B0B0B090204010D00161F23
0804130E0B0C0B070101090001321E0A1F2D320B0C0900070B01120B1E01490E
012A050929010215202214020C1003070D020D140D000000061505070F01060B
01041307040700000F03031D0C0B05001804022C02020D05021503141B38030D
04020D04010713050315030700070307002900020716010500050006052D1001
0B070707090E080C09160900101E000C231F100A0B1B01120B072A3E01160E00
0700000001000306220D0F060C000304000404000215330020020D3C05000514
38110B010808180907000B000513231601060D0309050D03140202030D040011
0F0405071B010E090011001B0705000025000104070006060304160B58051108
080800010008280909012A000908307F301F1F0C0C0B321813040808580C0B0C
1609090900031B070D03160917260404038C050D190303033A03020214130452
00080013070102160B010000021D060D0007000029050602020F14030D030003
0100020011133902022C0000030505050700052500000300040045120E080423
0E0B00050E11230E0C01160B0C0B1B1F1F2308183008100E04000001181F0112
01230003000005000001050E0A000203050504143303027D030605390003000D
00040B0C0E0109012D0816080B290002080100050429420B070406222015380D
0016003B0B0B09110F03001D01041B002A110009070006040000000034050000
0108071001071210093209160908163018070107090C550E070C00070E000004
0600000704010700050000070A0015021122143A2215063325010F1905000302
006B010F00010B131008030D070100070B0C16020D2607110B03040107000E0B
0104043400130E1607011809060403000F0605000D3C0500040201050001060D
060D0B230E07181E2D0B0E0E1E311F000807080001010601080C0008011D1105
01000109000506000105000E170039000211020C10040D220D02220002030F02
070903040101081601060502070106000C0E0B0025070400000207030B000807
110709080002111B120E28160D2C000E044C34250004000311061107040B1303
00000D01070C230908010C0E2C124A010E080004074900071D180B0B0E130D07
0308291D00031103060F050E170105022233000A0B0436030202190320020303
030503051116000509080E05070900050709080D2911051300000004264C0901
010105420000030D0518310D0D2A0000050B060F04050604050B0100072A0104
0006003204003B090901000B0108230E080C3B07002810100A09280801080005
0D1101000D030038050D04011E0002031503080A3205020F153514390320030F
03000309050D010C2D010300010331060C000305030F14000F0D090704000000
03043505040D0015033D1405080603020107043502070000090B00000406001B
0201003C160C180811070E28320700080E0E00161210304E1F1E0C0001030401
0300050D0D0103023F152908171100030600000A100C01252203200006020202
030411020D0D0B01010E07120F040B0801000000110506040402020906380020
350302030415040007061606151D130512100000000F0000060100010B010314
0311070701090B090B09180B0C0701040E0101083230101F0A1F340001060501
0205000B020029010B0411091E170C000D01040B0E0E0803021919050D020505
0505290300060E01080B0E0B1608002D0B070F000304040D0605060000070208
0F3A0D070C063313520D0203030B1D052C0303000001000D05000B0101070029
13010101130B070E01000301110C010609130E050B170C0C95230B0413110711
00060405040003010205060B0A100A17153305050D08000D1919140207060600
022204281100071301050B000C0C0905100912070D42070F000005132A040616
040F0D04000642150200000F080D2D0F080A0D0016062A00160D00070B080101
1B08000B0C00090B071D161658082806492812070C320E1876160100030D0009
010D002903020D0D0D0207130A0A0A0A1E061008100E0325020202350303020D
0604090100002D0100280401070801136A080023050709010500000006060F11
000D0206041919192E1C1A211A21211A2B212B1C271A1A211A1A212B602F332F
1922072A03120B011D000B0998081E000011000B180E0B077A080E0003050300
0109024106050F0302190D1B0010100A170A1E170A080322030222030D010002
060411100917010012090708181F4B0447110103060301000600010101050400
35193724272B481C1C405B1A4021481C242B1A1A1C1C37212B272121271C1A1A
241C242B5B22010300160E015012010307011D0E32320C531F0C010007000000
0B260D29021B0505050306020301090A0A0A170A0A09020203160D0225001401
0826040E060100393B01040209010115022202000D3507000D00001111002224
1C2B1C2B271C214040212B2427241A5B211A37271A24242460515D21211C2721
1A1C1A1A1A27432E1B010C0808280C3109010108300C0708080B130E03040400
0018092C140514020215000303201408100A0A10000702030303150205018803
07000205080D04090B0E040D0B0407020006030603020F28000D130703241C1A
1A212727242F14441902143405033A020F00180C00420C070907100036362F24
1A1A86212121271A1A6077050E0B0C0C0805080801230B301008000407110000
0711011122611415050638220514023D00100205030202021402030F29150302
050106010E391200090806080800000F2902020D012C28010F0620432493442E
032A1D0308000562040315140200000612130A1800050C1601010B0101010400
05000719432E441A1A5B241A020B090878084201001F0C0E0C0E2D0400040004
160401063C032202150D03040202060502000302020D00000406090511030600
030701410B011304390504080C050B05050203024105001601022E0203110601
01030404012904111800130402204A2C0F020D050284050D19251B0007060600
060707180E0B10011D012A43431D18140F640000000800180B01000104000520
00030245020D03020005070D20140402010B02000D2502042500250106070000
030600000107010801150223120B00030F02020707000801100C0E1601084500
030304380764013108001B000B2F2E511A24601A1A5B1A211A21373601060101
0001160B31010C130801070B0C00091463020000000B114C0101041600410206
0D0301141922020700011102000D042505001502031B14000304060D660E0403
0006000B0C3101010D060006070004010D01001B04040C0E0C100E0000050716
042A3B070C0C09011F2237272B21271C212751241C212124211A2B214305040D
03030B0C5F320E010C0108110B04012F36376807110900000C09000F00090705
030E0814020202060D03290405050500000506060503050D19060D00042A0708
0405040601010908130F040D000D000609040400160108010B070101092F0101
090B110611090900191C1A1C1C401C402E362F2E732E271A1A21212B1A2B3622
0F001217100A00141A1A43140E07010000040025290B010100070111070D0400
0D0041150D03000D15020402030607011606005900000106150F010706000900
03090307070B0E0C010404030302090507060708010D14040004010700110700
07080F010808014424211C2B022F0222041E0E08001601001D02241C21211C24
360D0A0C7C0D2F6051212B1C1A19000D04040709053700120001060B080B0903
06020403030F06000300021D8B0D06070101031205010006030449040D2A0000
0B000404091D01000531000302010B080C4C010007190302110501134C050901
1D181B0B0C012E1C1A41220D020200000408070C12050B1D0000431C2B1A481A
2124490A12244308141A2721270D02060603010000514400051347180A0E0C01
2A011903023E0D0D0215030207110B001104020203030204070D060D01040705
0B01000B010C0E06000009000239305E0B0007010943010403220D3509221D03
032501060244241902000900000F0D05192451241A271C1C1C1A1C481A211C1C
1A1C1A012F2468051327241A0704040403380201202E27070001070101130106
0802030003000202030303050101080400050203040202000F02250605020500
000103000F0108020D0D1809251208091D1B0704181C0706070002060720032F
0215001937190905060508000D0F3A2B481A24211C481C40481C21691A1C1C1A
241A24246824376E0C20432E00140005040B010B001A21160E000A08090B010E
0B040300000D020D0000030F1600051D02030202060304070504050029020400
2A05070D0B011103000600080618100E06000C050027271912130004350D1536
4419515D051618060800091602212727276E0300250214191514192724378627
211C2B2421211A1C371311000B0F03021B1100070524029904025E010001180C
0D0904000603060202000D05260000050000150003020000030400040D020106
0D11000107080003020100502D320C002807006207961C1C2E2505140F031433
2F6E2201120105060D03010107031504011301052D06003A0D03000006064908
043721211A1A2127212E43221303142F01000D372724011B090101010B0C0B01
0805010D00410206140000000D2902000300060303040D0D0400000600000013
000704040B040B121F08040B100100010812160008012F46482B275D22026284
020600050800001D1100000900000111060D091100150400130639014319540D
35431A211C2B5B1A212424200004040D2F2E1A1A19202600010B1617070B0100
110516000F030F0D04040001001B040B040902066107060D0D04032C00041103
0100090F0001000900110B00090003180B08003118010B0636212B1C1C371933
1D05060500071304162607000916390200060219222E2003881A211A1A516024
241A1C1A211A1A1C1A211A1A940206142E37364302050B0B0B0907090E080701
1301110002010302040226000D390305060D0D03450411030603130700010304
0900000007061B2C090409080C0C08060B2D090100710901050D192E27211C2F
00070007070E050001010407080E0B021D0406194637372E37372E2E2E54442E
2B211A1C211C2B242B1A1C1C21211A790B353E02050C080707490C0A231F1230
0B01070D0407000603003403020606060507140300030000110C071100130900
070118060704381104000005010801071E3E091600260B01074207072F193600
081F04000107001116000012011F1215050D00070005080711010C010E030303
2F19222F27212B24002E24242427211A200E160012130C12080E0A0E12120C28
110504030500000D130000150005040202000300040F0708080E130008110100
2C110B0426020300060D06060E0E080E17086B1107070007052C000B0B1D0005
000705000000005208260F010B01060D06092834090F072036544436602B2127
2B1C1935092424242F000120242B1C1A1A020D00070B0507260E0A080B0B0B0E
0600390005070103000002070B07040204250D07060D01124C0D040B0E000E12
061304010D11010D0D03250E0E0B010B01120809120201010000050807004C38
0500070F000D091F3412040000010B0800001E080205160000034324192E225D
271A1C1A242E2E246809180B112F271A212106000900030030091F3001010305
0D040504050503070D010204200000000D001D04020005060B04091800010726
11000B010301010203002A020301180C45070C070E04061B1603040D0004052C
060D01021503031D070B280F06002C011B0801000F050514332044364D190302
540505432121692B1A2F023624290D1A272103110B0D0104120E120104380302
020300250029010603040D050600070200030901190D060F0E0707070108115A
0E322601030604060003030200070B070008230018083B080001290B090B0008
010301032E1A2F00001166010207052E1A242E2E1A1C271C482B1A5D27631C1A
2027511919372B2121462E245B240B191A24010004390F0400041300000D0000
060D000D111D3C060038290203030D02030F01040603040F01090C1F0C010809
04000B000D0213032F1406020B050D0007080005078E01180C03150D00000003
2F1A1A1A443A00290505001D362F2F2F35142F1519200322200D2502192E7021
2B1A21371C37432740401C27245D000724010C0010000B080206043C000F0202
02000D0300000600040502053A050700420007070007081201080132080E2600
00000108051901020203050304160304051F0113120B0B00030D00080936211C
212E433C0700490C5A002F5420190322032019222214202F460222452F030005
0F22542E37271C372744241A24437751050713010B0804010D02020205030D00
06032A060506040329040404020D01000111010B010109120004010E0C010009
0118070905420D390503150026010007020B000B0005070D05071B052421242E
050105052E1A2B2427242121211A1A1C2B402B211C1C1A1C2B401C1A271A271A
27242E031402152F6E37032E462E2444122D100E1213010804030F4102042904
0000350D0012050002200304020000000B000B040501000307320C090E000B0C
0B0908011D002F070303020116030C010D0008010B0316060100441A1C190705
09034021401C1C2B481C211A27481C241A1A2B48691C2B1A21481A212B1C2B1C
1C2B1C481C371502142B2704031107080B0B12100701040D0D02150406030103
060F0202030F0005050F02290600072A16030901011D0011070E230B1B09090B
00080C1D030D020F0F030F0D18040B05020708070B0B07010B075421361D0502
06072054461C1A1C241A1A211A5B1A2127241C4069401C242727211C271C2B27
1C2B1C46360202030502212E1300000701000C3B0900130D140203030501030F
0400060203050B0006020D0205010D0F01001B0104010A0209081304000B0C12
0300032000081201000501020F020F0002200D140206190314192F244D220303
0B0107050000010502022E46245D27372E19372E464336362E192E462E2F0326
000009130B0002021B034424010411010004000D050503040506040B2C04080B
1023100C320C0A0E18090C08282D1F0B1E0B000104260500000D000159002D00
0D0201041D2A0302050603030D050306050D19020220140319021446271C3619
0065080F0506040F030279033D051500000F04043F39052634090708000D0836
030009010004003A2B212E111D070705130D390202150500050404160300090C
30300C0B2D090C230C1F1F0A0A1E04070E09090B000406022006070B1F015F0B
00010B061414050202050303021402030701011936333A330319190D191A1C2B
2E5102292C0101050115061325020302040202000012061806081F11002E0D12
06030D252024271C1C2B020213010004290D0504020300020106010B00050F01
000C18083E2D180B0908101E0E08090C00070B090507000829000C0109070401
0107410D000403020219141902201519041207030F192F140302150606153337
212B212B24360302021D0B2A06020304060F030E00070F0200230B0300022268
27372B211C911A331902021100001B0D0D020701010F050F0D06000804060013
0E120016120C16105308080B4A0A0A0C01070E2611043C120E0E0B4F10530211
00002500002A1B0014023D02021402030D0314023A2002203A0F014713380052
3C034444442B1C1C4320340346450F35040100000D060D050D19192E2B481C48
401C2727463D0306042F050F020D0F0301008A000B0904250626001801080100
070B1212110B183018081F501F0A1E080E0E11130911081308000B0C0E3B0B0C
290F25020202020105040322020314200602022020143F06190305002D0C0A23
080913070F0E02030D3744040F362F19051B0422362E1A271C1A2B461A273702
191920030403050322020D0202203D040301012600010404041D00060D010004
0C100A01050001070B1847100E1F1F0809010126040B305F1600011B0D090B0B
120800011B063A050D070D1B05030007000525060202203C08010909450E0C0F
0C01085C2C0301010300051602030305220211022E19023503220F010D04190D
1405051525020002020F02030503020F02110304000005030411041107070B01
0B0E09070F01090B0705000C180808120008311F050B0C080C010406064C470E
0F2009070325030D250B050305032A05020702022506140205012D4B051B0101
0E000D060F0206050D02030303020F001900000004060D040001031102050306
023F0F0F0F03030D0F0D0F020215140D030106060D0302000500000B13110801
1B08180800230C0C4A580C5A0107070C28010C163101080104001D0C2D4B0F14
1B0F021D14150305030503030304020213000F022F2002030202060612002000
04000100050D05020503022A250219004619040605060D0D0D06360352200F02
15150038030D000304020D0503030D0615040605140D04020500082D07081208
0B120808110C23091E1E0C23100B070C18090B0C090812110F0D0E0132050E02
021D150F021920033D0D03050503030239000505023A07062202100912040603
001201070000043F04030F1105001919541C730303040F030601420605000000
043A02140206040920060D0606062C020303060200070F000D00344E0928010E
0807122A01005310084E0C1F302D0C1F230B112A0112050B01041D050D000102
04030B0F030329023F031419191403020503001302220202020001230B060011
0712050B0D0605110D06030305192F02441C2705140006032004000300030901
07140502022A000006050D000405140206000206000001000005000C0B1E0C01
05000801070C0A10310E0B0B18300E0C0C23070B0901000412030F0902041402
00390F1D0E0F0002032F0D14201414140202021B1B141919030005050000160B
000F03023803080203350205050203022E21271A010F0D041300040036150113
0401080206060011000315002C030202020304380309060712130E090B120B08
0801083E761001230C1F080901101228011600090C040001000F11080C000005
053D031D05050D0302070F0F152F15050422020200030F2C0200040407000901
0708000701010800060F3A201425020F021A2B402E0D08040800000219011601
0F1D031501110016021B0202040F0219040401060F020102050100010B071B08
3E0908120B0A160723042A0B080B120001010C080E00071B08005A3E0C180106
0406040F020D0F030502192F15220F2F0D0D0F151D143501030B010600162309
08473E09130100010A0E0925020D14030D02461C404400000506010405360D03
0F000D150D07090100060406000204030300010008040D0F00000B080E0B0801
120A010C1810010B08081301040816080E090A0C31010108010013820B010F02
060D130502002535060F150D030F031502050020152201110900010D30281612
070B1309054F4E015C1B151B0420540D35190D1A1C2B2F070401000400020506
02060422060109001002020F1915030606050002110505000001110112070C28
0C0E0A0C18010C0B0C120B01120A0A5323080C18084F08261208180B05050602
0D0306030D0020200402022515030202350606000D4C121D00180907300E1201
1D006A07010B040D053C030503040F2005040019272B3604000F010D00130002
000108341302050B0002140213130D0D150006010607090C10010709260C0C12
0B10100101070B090E01083010320A1F30550B0C180E111605010E010705001B
02010503060C062C060E453D2F330F1415020018092A150000092D0C2A120700
01010A1132010506030D0235050315060F1B0F0327482E0403030F000214153D
02020D161106040D040002090F0402030F05000D1D0001282D110807300C5E08
0A083400073C081B040B0C1F0B0C1F1F0E320C0E07100B0102060622051D0616
000203055C0B071207130114333D0502023305032006000C0907090C00081612
01030E0718060202003B03773A19200D3C050F37212B1100130002000000033A
03000B1103050000031302030103020406020442040901504A0C07010B120400
070B090109070C08310C0C1210080908010B0C3200010C3B0202121B090C3E12
180F19020507180909000D190206000202021402061B060001260607090D0203
010307090500020103031D041503140204033740270F03020F0200110D02050F
050600050004120F000015021522060220020300011D0D1D280E0B311201286D
0B0600070C0C08180B0B09000E0B1207000C0B000B090702040406021D070726
500503220D050F0012000D1414021B00062003030100004509010B121B074504
0D081B07094122061B141419351402060537212B190404002C13110604011502
0204050200030F2A0D03040403040D0F14001111100413090C4F32104C083408
080400070C3010100C1E0C0B160807000930050E096500010C0703050F040500
22140F1402020305050706040B060F330214020700191520030222201B000702
05000F070B0100032002020305222A05191C1A15251D02060501092A0403006C
04132A0200040006130003110F0014381402021B061E4E0823230C23010B0801
000B320E10280C0A0C081E100B0C2816001B281B09040301010B050600030306
0D030300000006160101012C080B04381902020F2A0302002A030D061933160F
060005091E08080001030903040605002E210300040202450D04056C04003D26
1101000D0001090003050402030F03023A030308014E0A100C181F080B090811
00010B0C08300C1F1F08580C18080B0E0901160C1200030400020F03031D0005
030B0000640704121D03070B00002C0614022005090F06051420022902290403
020202180C1009520114012F050203062E19090E006504030214061105020405
060B004500010B120009010000120202151404231D0E23320C0C5F0C0C010008
32091028011F1F2309120B010B09041F0C160E100907024212051D0513090500
01090007000205180F0D081B090F0E07023A2502030425010300000102252502
0F22052916300500070489143A1611051A03020E2300021933190004042A0F00
0E010B0007000900000D090B07000F000200021E0F850B0E0C01080701000912
0C09970E320C0807002C000B0C551010170C08100B04000B0B04000F00050118
180602001114001216000A1F320C0F0D0F020F0D1801060F0203001D03052806
0F2A000B12130412120D3F022C070D25400202050D040D0606040500040F0D0D
000711000000010B0907000E311303060000070702060406031012061B0B0704
071107070B0E0C0B3403040E0C010C09120A180C0F311601050C080B06031B1D
00350D0003020B200C001F4E0A091505050303001B0F02063F0202021402020D
04000000010006030E030000120B03041A14030006140268020511020605020F
010101000C0900000701010D0105020D07090801160702030E08132C0F010204
3210092D18093E0B0113071F1008741F080C1232281101121301040403030503
0D0F03070D02001402490B473000090500042A06072C04140503000000060602
090304140203020606200F0007021D0321050D060F1422732F3F060F02020D00
0000000013110B01010113090B0B000018010B011201060008083E100F130601
0830080A0C0701080C01280A0E01110B0E0C01184A000D000B07010003050000
00011100000302040602010602260B38001D16062D0100060F02050D0B070110
0403001414383341020D07020203350D2B030004141433272F022C0002150206
02010904020626090001010B260F09230E160C1123070100120B101218070009
0B01550C0118090C00040B0001070013080B23090B1F2C1208100B0903040503
0303040005030400010206031947001D0815022A1206020D0203030701010830
090709020402141406030203020215051C0209040F15242E2C1912020F420209
0400030201041B0B2D13302D120B00050B0E0808320C080A09281F0C080C000B
0B340B0E0808300C0E010809083008120E080C320B0E080B1F0C001826070306
040B090B0B0E13050502030D3F020411060D001606001414021435120216080E
0812060D0F03151402151411020700062437051304002B1C3636020106030604
060F000D01040108080C234B50302C380F0B450E12490B0C120C1F1808083209
0007081F0E0C0C0026180C080C1228083E120E0001180E0A0B0426161D0F0713
0729060D030B00042907111D0D05022506220500030319040F0D0202140D1B01
043B3F02201D00034103012541000D031C211A2E06191927360204040011030D
0F040415000426095E1E0E23280C4A4508261200060B6607101008120C1F1804
0B0B010C081B010E07002C0001010B000808081125010B120B0E07052C310D05
0809090749000701070B03053A220D1B111589050300330315020F0000000900
3A1919030D0D351406060F0D0003020540401C1C2E2205064D36040B04010602
0302000215050B1801472C0C231F0509000108010818306A0B1212011830230B
28010707010C08280B060B00001231180C013E163208075A01072C0202010605
4B1F5F0005000101110320143D0202030002253D023D4B14253A200D03000B38
1415030F15220D0F00000703063D040919481C1A1C402E631A20040D03040004
03040F0D02022D13016D01070E2D042D0F110C08080A7A6A0C281F08010C491E
0C091667070C0E010A870E280B090C4E2308090C0E4F0E13100A311300031200
0000000B0405010703010603034101141108000F1404001120140F3C03150402
0D001B000F0D251402151535200405001519631A272B1C2B27147D040D030202
0F0F0D0B0206002D110104340711011203001104084F170C551F0810160C0C0A
0C1D0C1F32080C080C010B0B1211070A0B4B230B050C0A011F0E0C3B0011060D
000000000103030F0007010502061503051B000205030D000302350603060602
0D0F0004061D020435050206030104043C0009462B1A692B2714060D02020615
0D11030202063803020402000161070F920213010B094B0C090B0A4A12100C1F
4B0C0E3E09011801070900010C3E0B1609080A0A1E170A100A17080E0808010B
000800030105070B05092C0300111D020338200320220303020215150F020004
0002050D00020400060F030300260314141411062021272F2E00060F02030202
62023F000447020603000F01060404000402080810080B01182D0A4E08230C0A
10080C0C0A0A100A0A170A171E170A0A100A170A170A0A0A1E0A0A171E170A0A
100E0C0C000000090023830009085202452214221903022A0303040000023401
2A00110611010202031116042C0215020202000006040D040602040F14010202
0202080400072D09662600090E0C3100000C1210170A0409000B0E0110103010
0A0A0A171E170A1E170A100A0A0A1E170A170A1E0A100A170A170A0A0A0A100A
0A100A0A0C080C01090B1F08021E0102030202151402020302032F030D04093C
22152C040901012C0E010910000322030303383F0F022904060D061106030202
060F260B090F071F0107010E12080C0A0C0013300C08040F0E10171E170A0A0A
170A1E0A0A0A170A0A0A0A171E170A0A0A0A080C300C0C12010E2D0C0C0A0A0A
170A0A170A1E0A10170C301304120005141D002202140202142202022F2A0506
38022A00093A31011E131F470F150204070F01091205382C006C020F150F3F0F
11040B0C00132C0001011B0C0901300C1F12550C760108170A0A0A0A0A0A100E
2D0C17080B0E0C010C0C1601280C09160812281809010B0B04060B01014A090B
090E171E100A170A0A0A0A0C130F033806200202091638031520151514141914
22030312053474080C1E160C000502223515000B0007060008040D0605020202
020600053B0B01090107001F4A0E0C0A160C0C5E0C0C100A0A100E3004171308
010500080013080718011D06110C0804010C08070B0701130713040801474C09
530C091605000E0910080A4A230F150412060412060113090F00020202060F02
0D1100006D2D184F0B0105110214043A0F000C0102060E131209020F01040200
0D05000B4A8226010200050E0603124A757A0B7C100C0E290007083104110704
01072818000B1F4716130E040700121E280B0A0A0A100C011F1800060011000D
300A2823080100010B120C1F092235330213000F120D011B00000214095C1259
000302310E31120A450F04091D020D410004160414110D03340D06110000060C
0013340C0A1E01001514012C01011F0B0A4F171F01010115054703160007090B
051213002D0A4B010C090C101010170C100A171E170A1E0A10081301130E0501
07161F7E58162C06060C072D0704044D634D0D0F050F00000001652C0D0F0406
00132D123B010F1E000216070F001605020312040F05010001070F135C07001B
0E0B00001809120906040D011B1B2812178F7C0E020D02170E300B0804010800
18090007070C100E100A171E170A1E0A0A0A0A0A0A0A0A170A1E0A282600020D
00235E556B0A12160909050C1209131102194D020B051402330D00113F06132A
010E1E316F0A6F0C02007B01610923010F053B0400130F000402110401060006
0E100B00000E0701080305090308094B08554F080006190C0118081828081001
000C160B1E0A170A0A170A0A0A0A0A100A1708171010100A0A170A100C081300
09100A7E830A1E0A0A10100C080909091204030F1013060203030204013B0300
0F012D103B2D1234030F042C0E0F001234030105110409040301080909121608
0C10122C000009092A040142090B2310130C0C160A09010E031B16100C180E08
0C011F100A171E17101F1E0801080C180C10010D05081F0A100A0A0A171E0C08
0142100C0A100A100A0A0A0A100B0B261D00020D02011711020606020D000126
010D00120900021B2C0304220F0D1B130006112900030404001E01071109080B
1201060512111106030141010113090116100C0E0901000B0F110B0E0C01093E
180C100A0A0A0C23080800000D07010E090C08000B0E180C0A0A100A0A0A100A
090B1E0A100A10090A170A10120109591D00050302011708110404040F220200
0003020005000215070104042A0229000015000504000200050E000411070E00
09131B01340012060304080009083230670C010E16130E07000008070C160009
100A0A17080B260B120001010047090930010A170A100A0A1E170A100A170A1E
1701170A0A170C08100A170C1304490B010B000100060A0A0D04131B020D0205
050F0000060E00060320020061040D0C08000F1D01021506092504112C100C00
0C0C03000001030602010101000A0C1F100C0808041D09330001230818070209
170C0B010B010C08130105040C100A171E170A0A0A0A0A170A0A0A0A100A170A
0A100A170A1E1701100E0E16050642000100053201000A0A03040100060F0203
0504000013030402021406090909111111013C020604000203420B5602670900
08070E04010E030100040000010A4F0C1010470C130E0600020B070701194D3D
0E010716070E080811110E170A0A0A0A0A0A002613000926082D0C100A0A1E17
0A0A100A100A170A09080D0001090900070905030E080A090600110403030211
0000042A0504390F06150908002D01060400000602040302010D005600010812
091864040E010112011B08070B10170C0C080F080C0204020D0203024D4D0601
07070E18011612004D4D08100C0C010701090F0F00040D03000500000100081F
100A0A0A0A171E0A0C100E290704032001080609170A17110F0206110F0F1520
051202060F0F0404150C0781011818010B0C06040D0D0F0F2A090C0E006B0409
0202050B3C070004050701011010170A0C0B041B0F00010003021D020D080D08
05660801010100033333010400000D05080000030F0107110411090908080E09
0A0A171E170A0A100A170C000200020508080C0A0A0B01070104000600040F14
14000D0400000204060F041104080C160B0C001533141326060001083B110F11
0902003C03060D250101040F10100A0A0A1017080800070B070D010B0C07070A
0B3E010006000D023500290506070000000B0000070E10100C100A100A171E17
0A100A171E0A170A171E0A0C090005080A0A1E0A01140D0102070E040F070002
1502590400090009095706010E311E1F1F0A0006140F0D030D14027B0406030D
0500050502040202030300050B104E170A0A0A0A0A10100C0E0016180C010118
00031D0D0205251414092A0707030704040B1E0A0A0A0A0A0A170A0A0A0A0A0A
0A0A0A0A170A0A0A1E170A1E170C0816000803110D1300073900000126000206
06152A0100182C0F080104500A342309014F0F0209133F140013000404033A04
52060D000002030F0202050302280E780A171F10170A0A0A1032053207030708
280E13060D030F040D250001070105080E10070B0B0008130909082C0401100C
0E0C0A100A171010170A0A170A0A1E100B000129123501120E12011304030F34
0000131600520004120A100E002600084A010916111D01020F00010107030300
12030F02000B04020402002D01000C1F100B01080E0C100A080108230E080001
0C0106000214022503020D07030D0001000004050001230009000E08080E080E
16080E0C0A0A0A0E0E010C0A0A0A170A0C0502200506000007010001005C0000
030D010E2A116511100E04070D310B2D3B16390701083400052202010000380F
000439191504004206090B10071606090C0C08001413000B0B00080701000700
0C0E072A020205050407250205030504020D03071008100A1E170A0A0A0A0A0A
0A0A0C0810100A10010104040C0A1E170A1000020F1B09000105120101040F0B
110F00040502000C0101005001130174501E020D0500010F060302162D01063C
15221B020203011113100110050E2810301F3E08010100070D2C01000B010700
041B290203000202030503039A06050006060505050709070801080B04080C10
0E10170A10171E17161609000C0C170A1E170901001B091B1304000200003407
0128120D000F06091300310E260F45261F5059020D0D0513413F05060D09010B
0D0106000F250206014F090E1628010F321E00234C04070C000C080B00000C00
06020F020F00032003000429070916030005080808100E0C0E09090909010901
01000C1E0A0A170A23080E080A0901170A0A01130104011102071313050B0D0D
011326131412340E01041801000156100E0E13010603020100050E0604010307
01230F0D0C3C0B12280C7528010B5A1F0A12161800070B1F07230A160B070701
0115030503353C2503030401030D010700080A0A170A0A17100A10100A100E30
17090C0C17100A1E170C0A0A0A0C09090A1709000D000203031D000D00020215
0213800902153A230604020C0801231208010D05000222020541040714082302
410C030E050F0E1823091101090E0101070108000116120C00000C0C31080C0A
08160000000F061B09090B100A171E170A0A0B000E01000C0000010C100C1010
0A100E0A090C170A0A0A0A170A0E09040A2301000007050904001D2A00000003
0200000001000B040D09560072560009010039023F13152F1406040202020100
14050F007B02081B0316111E000B010C100C100008095A000C10170A170A0C07
0818120703050307010B090109123E00000009080B09080E0E010804030F0300
0E0C08080A0A10170C100A0A100C170A000305110608010000000F0304051100
04040001110F04030F01231E0012014772083B26040502030400420615190000
0F000435110402020401040B0E16080010230C010B090E0A0A0A0C0A23080B0B
011B132A0309090701080C0809080E090B09170A100A171E170A10100C100C10
0C09000108000E004D0B0E10080E100C6200062C090108280001111309152908
06000E0B6D00020206030F01520401101104080E090F0015790F050102200220
0D16021529020D0205091307160E010A0C0B3E0407100A1710080E0307080C10
1017100C10170A100A171E170A100A171E170A0A0A0A0A0A0A0A0A0A0A0A0A0A
0A0A0A0A080001154670000215150000000C010E05080C0E100908111B000C3B
044907042D121103020506011300090911090016043942000025020405061415
5900030205090F14155E01010101090007090B0E0A0A0C08300C020B0A0A0A0A
0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A}
Visible = False
end
object btnClose: TButton
Left = 300
Top = 10
Width = 93
Height = 31
Caption = '关 闭'
TabOrder = 0
OnClick = btnCloseClick
end
object btnPreview: TButton
Left = 113
Top = 10
Width = 93
Height = 31
Caption = '打印预览'
TabOrder = 1
OnClick = btnPreviewClick
end
object btnPrint: TButton
Left = 207
Top = 10
Width = 92
Height = 31
Caption = '打 印'
TabOrder = 2
OnClick = btnPrintClick
end
object btnPrintSet: TButton
Left = 20
Top = 10
Width = 92
Height = 31
Caption = '设 置'
TabOrder = 3
OnClick = btnPrintSetClick
end
object Button1: TButton
Left = 758
Top = 15
Width = 92
Height = 31
Caption = 'Button1'
TabOrder = 4
OnClick = Button1Click
end
end
object pnl: TPanel
Left = 0
Top = 50
Width = 792
Height = 411
Align = alClient
BevelOuter = bvNone
Color = clBlack
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -15
Font.Name = '宋体'
Font.Style = []
ParentFont = False
TabOrder = 1
object StatusBar1: TStatusBar
Left = 0
Top = 392
Width = 792
Height = 19
Panels = <>
SimplePanel = False
end
end
object PrinterSetupDialog1: TPrinterSetupDialog
Left = 364
Top = 52
end
end
//////////////////////////////////////////////////////
测试代码
//////////////////////////////////////////////////////
unit PrintPreview;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
printers, ExtCtrls, PreviewPanel, StdCtrls, ComCtrls;
type
TfmPreview = class(TForm)
pnlTop: TPanel;
pnl: TPanel;
btnClose: TButton;
Image1: TImage;
StatusBar1: TStatusBar;
btnPreview: TButton;
btnPrint: TButton;
PrinterSetupDialog1: TPrinterSetupDialog;
btnPrintSet: TButton;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure btnCloseClick(Sender: TObject);
procedure btnPreviewClick(Sender: TObject);
procedure btnPrintClick(Sender: TObject);
procedure btnPrintSetClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
FPv: TPreviewPanel;
procedure Draw;
{ Private declarations }
public
{ Public declarations }
end;
var
fmPreview: TfmPreview;
implementation
uses
UnitTest;
{$R *.DFM}
procedure TfmPreview.FormCreate(Sender: TObject);
begin
frPreview := TfrPreview.Create(Self);
pnl.Align := alClient;
frPreview.Parent := pnl;
frPreview.Align := alClient;
FPv := TPreviewPanel.Create(Self);
FPv.Parent := frPreview;
FPv.StatusBar := StatusBar1;
FPv.Margin := Rect(1,1,1,1);
FPv.Columns := 2;
FPv.PageCount := 2;
frPreview.Show;
end;
procedure TfmPreview.Draw;
var I: Integer;
begin
try
FPv.LineSpace := 0.5;
FPv.ResetPos;
FPv.AddSpaceLine(2);
for I := 0 to 20do
begin
FPv.AddText(' 撒赖打开sfdg飞机了;按时b地方看见方看见撒赖打开g飞机了;按时b地方看见撒赖打开g飞机了;按时b地方看见撒赖打开g飞机了;按时b地方看见撒赖打开g飞机了;按时b地方看见撒赖打开g机了;按时b地方看见撒赖打开g飞机了;按时b地方看见撒赖打开g机了;按时b地方' + IntToStr(I));
//if ((I = 4) or (I = 2)) and Assigned(Image1.Picture.Bitmap) then
// FPv.AddPicture(Image1.Picture.Bitmap);
end;
Caption := IntToStr(printer.Canvas.Font.Height) + ':'
+ IntToStr(Canvas.Font.Height);
except
end;
//FPv.Left := (FPv.Parent.Width - FPv.Width) div 2;
end;
procedure TfmPreview.btnCloseClick(Sender: TObject);
begin
Close;
end;
procedure TfmPreview.btnPreviewClick(Sender: TObject);
begin
FPv.OnPaint := Draw;
FPv.Preview;
end;
procedure TfmPreview.btnPrintClick(Sender: TObject);
begin
FPv.Print;
end;
procedure TfmPreview.btnPrintSetClick(Sender: TObject);
begin
if PrinterSetupDialog1.Execute then
begin
caption := inttostr(Printer.Pagewidth) + ':' + Inttostr(Printer.PageHeight);
end;
end;
procedure TfmPreview.Button1Click(Sender: TObject);
begin
button1.Caption := inttostr(sizeof(variant));
end;
end.
////////////////////////////////////////////////////////////////////////////