1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
procedure TForm1.UpdatePrinterInfo;
begin
try
ck := SGrid.FixedRows;
SGrid.Clean;
with Printer do
begin
if Printers.Count=0 then
begin
AddInfo('printer', 'pas d''imprimante installée');
exit;
end;
AddInfo('Printer',Printers[PrinterIndex]);
Edit1.Text:=(Printers[PrinterIndex]);
Edit2.Text:=IntToStr(Printer.PageWidth);
case Orientation of
poPortrait : AddInfo('Orientation','Portrait');
poLandscape : AddInfo('Orientation','Landscape');
poReverseLandscape : AddInfo('Orientation','ReverseLandscape');
poReversePortrait :AddInfo('Orientation','ReversePortrait');
end;
case PrinterType of
ptLocal: AddInfo('PrinterType','Local');
ptNetWork: AddInfo('PrinterType','Network');
end;
case PrinterState of
psNoDefine: AddInfo('PrinterState','Undefined');
psReady:AddInfo('PrinterState','Ready');
psPrinting:AddInfo('PrinterState','Printing');
psStopped:AddInfo('PrinterState','Stopped');
end;
AddInfo('Resolution X,Y',IntToStr(XDPI)+','+IntToStr(YDPI)+' dpi');
AddInfo('PaperSize',PaperSize.PaperName);
with Printer.PaperSize.PaperRect.PhysicalRect do
begin
AddInfo('Page Width', FormatDots(Right-Left));
AddInfo('Page Height', FormatDots(Bottom-Top));
end;
AddInfo('Printable Width',FormatDots(PageWidth));
AddInfo('Printable Height',FormatDots(PageHeight));
AddInfo('Copies',IntToStr(Copies));
if CanRenderCopies then
AddInfo('CanRenderCopies','true')
else
AddInfo('CanRenderCopies','false');
if not CanPrint then
Application.MessageBox('Selected printer cannot print currently!',
'Warning',mb_iconexclamation);
end;
except on E:Exception do
Application.MessageBox(PChar(e.message),'Error',mb_iconhand);
end;
end; |
Partager