Mega Code Archive

 
Categories / Delphi / Printing
 

Printerin tüm özelliklerini listeleyin [parça 1]

uses Printers; procedure GetDeviceSettings(DevCtrl: TMemo); var Sep: string; procedure MakeInt(S: string; key: Integer); begin S := UpperCase(S); DevCtrl.Lines.Add(UpperCase(Format(' %36S = %d ', [s, GetDeviceCaps(Printer.Handle, Key)]))); end; function StringToBits(S: string): string; var H: string; i: Integer; function SubStr(C: Char): string; begin if c = '0' then SubStr := '0000'; if c = '1' then SubStr := '0001'; if c = '2' then SubStr := '0010'; if c = '3' then SubStr := '0011'; if c = '4' then SubStr := '0100'; if c = '5' then SubStr := '0101'; if c = '6' then SubStr := '0110'; if c = '7' then SubStr := '0111'; if c = '8' then SubStr := '1000'; if c = '9' then SubStr := '1001'; if c = 'A' then SubStr := '1010'; if c = 'B' then SubStr := '1011'; if c = 'C' then SubStr := '1100'; if c = 'D' then SubStr := '1101'; if c = 'E' then SubStr := '1110'; if c = 'F' then SubStr := '1111'; end; begin StringToBits := ''; S := UpperCase(s); H := ''; if Length(S) = 0 then Exit; if Length(S) = 1 then S := '0000' + S; if Length(S) = 2 then S := '000' + S; if Length(S) = 3 then S := '00' + S; if Length(S) = 4 then S := '0' + S; for i := 1 to Length(s) do H := H + ' ' + SubStr(S[i]); StringToBits := H; end; procedure MakeHex(S: string; key: Cardinal); var h: string; begin S := UpperCase(S); h := Format('%X', [GetDeviceCaps(Printer.Handle, Key)]); if Length(H) = 0 then Exit; if Length(H) = 1 then H := '0000' + H; if Length(H) = 2 then H := '000' + H; if Length(H) = 3 then H := '00' + H; if Length(H) = 4 then H := '0' + H; DevCtrl.Lines.Add(''); DevCtrl.Lines.Add(SEP); DevCtrl.Lines.Add(''); DevCtrl.Lines.Add(Format('%37S = Flags(%S) Key(%S)', [s, h, StringToBits(H)] )); end; procedure MakeFlag(S: string; key, subKey: Cardinal); var i: Cardinal; begin S := UpperCase(S); i := GetDeviceCaps(Printer.Handle, Key); if i and SubKey <> 0 then DevCtrl.Lines.Add(Format(' %34S = Flag(%4S) Key(%6D,%S)', [s, 'ON ', SubKey, StringToBits(Format('%x', [SubKey]))])) else DevCtrl.Lines.Add(Format(' %34S = Flag(%4S) Key(%6D,%S)', [s, 'OFF', SubKey, StringToBits(Format('%x', [SubKey]))])) end; function TechnoToStr(i: Integer): string; begin TechnoToStr := '#ERROR# is Unknwon'; case i of DT_PLOTTER: TechnoToStr := 'Vector Plotter'; DT_RASDISPLAY: TechnoToStr := 'Raster Display'; DT_RASPRINTER: TechnoToStr := 'Raster Printer'; DT_RASCAMERA: TechnoToStr := 'Raster Camera'; DT_CHARSTREAM: TechnoToStr := 'Character Stream'; DT_METAFILE: TechnoToStr := 'Metafile'; DT_DISPFILE: TechnoToStr := 'Display file'; end; end;