Printing Delphi

Title: Information of the printer
Question:
Answer:
unit Unit1;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs,printers, StdCtrls, Grids, Buttons;
type
TForm1 = class(TForm)
grid: TStringGrid;
BitBtn1: TBitBtn;
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
const techno : array[0..6] of string = ('Plotter','Grid-screen',
'Grid-printer','?',
'Sign-printer','Metafile',
'?');
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
var dc : THandle;
i : integer;
n : integer;
begin
grid.ColWidths[1] := 200;
dc := printer.handle;
i:= 0;
grid.cells[0,i] := 'Name';
grid.cells[1,i] := printer.printers[printer.printerindex];
inc(i);
grid.cells[0,i] := 'Driver-version';
grid.cells[1,i] := IntToStr(GetDeviceCaps(dc, driverversion));
inc(i);
grid.cells[0,i] := 'Technology';
grid.cells[1,i] := techno[GetDeviceCaps(dc, technology)];
inc(i);
grid.cells[0,i] := 'Printwidth(mm)';
grid.cells[1,i] := IntToStr(GetDeviceCaps(dc, horzsize));
inc(i);
grid.cells[0,i] := 'PrintHeight (mm)';
grid.cells[1,i] := IntToStr(GetDeviceCaps(dc, vertsize));
inc(i);
grid.cells[0,i] := 'Width (Pixel)';
grid.cells[1,i] := IntToStr(GetDeviceCaps(dc, horzres));
inc(i);
grid.cells[0,i] := 'Hight (Pixel)';
grid.cells[1,i] := IntToStr(GetDeviceCaps(dc, vertres));
inc(i);
grid.cells[0,i] := 'Page-offset left (Pixel)';
grid.cells[1,i] := IntToStr(GetDeviceCaps(dc, PHYSICALOFFSETX));
inc(i);
grid.cells[0,i] := 'Page-offset top (Pixel)';
grid.cells[1,i] := IntToStr(GetDeviceCaps(dc, PHYSICALOFFSETY));
inc(i);
grid.cells[0,i] := 'DPI (horizontal)';
grid.cells[1,i] := IntToStr(GetDeviceCaps(dc, logpixelsx));
inc(i);
grid.cells[0,i] := 'DPI (vertical)';
grid.cells[1,i] := IntToStr(GetDeviceCaps(dc, logpixelsy));
inc(i);
grid.cells[0,i] := 'Brush';
grid.cells[1,i] := IntToStr(GetDeviceCaps(dc, Numbrushes));
inc(i);
grid.cells[0,i] := 'Pen';
grid.cells[1,i] := IntToStr(GetDeviceCaps(dc, numpens));
inc(i);
grid.cells[0,i] := 'Marker';
grid.cells[1,i] := IntToStr(GetDeviceCaps(dc, nummarkers));
inc(i);
grid.cells[0,i] := 'Colors';
grid.cells[1,i] := IntToStr(GetDeviceCaps(dc, numcolors));
inc(i);
grid.cells[0,i] := 'Fonts';
grid.cells[1,i] := IntToStr(printer.Fonts.count);
inc(i);
for n := 0 to printer.Fonts.count-1 do
begin
grid.rowcount := i;
grid.cells[1,i] := printer.Fonts[n];
inc(i);
end;
end;
end.