Недавно добавленные исходники

•  DeLiKaTeS Tetris (Тетрис)  4 583

•  TDictionary Custom Sort  6 599

•  Fast Watermark Sources  6 369

•  3D Designer  9 319

•  Sik Screen Capture  6 703

•  Patch Maker  7 084

•  Айболит (remote control)  7 088

•  ListBox Drag & Drop  5 955

•  Доска для игры Реверси  97 496

•  Графические эффекты  7 290

•  Рисование по маске  6 584

•  Перетаскивание изображений  5 457

•  Canvas Drawing  5 826

•  Рисование Луны  5 537

•  Поворот изображения  5 058

•  Рисование стержней  3 623

•  Paint on Shape  2 864

•  Генератор кроссвордов  3 750

•  Головоломка Paletto  3 019

•  Теорема Монжа об окружностях  3 828

•  Пазл Numbrix  2 519

•  Заборы и коммивояжеры  3 219

•  Игра HIP  2 186

•  Игра Go (Го)  2 117

•  Симулятор лифта  2 499

•  Программа укладки плитки  2 149

•  Генератор лабиринта  2 633

•  Проверка числового ввода  2 303

•  HEX View  2 635

•  Физический маятник  2 255

 
скрыть

Распечатать TStrings на принтере по умолчанию




procedure PrintStrings(S: TStrings; Font: TFont; Title: string);
var
 LeftMargin, TopMargin, LineCoord, LineOnPage, LinesOnDoc,
 CurrentLine, TextHeight, LinesPerPage, LineInterval: integer;

 procedure StartDoc;
 begin
   LinesOnDoc := S.Count;
   Printer.Canvas.Font.Assign(Font);
   Printer.Canvas.TextOut(0, 0, ' ');
   LeftMargin := (Printer.Canvas.Font.PixelsPerInch) div 2;
   TopMargin  := (Printer.Canvas.Font.PixelsPerInch) div 2;
   TextHeight := Abs(Printer.Canvas.Font.Height);
   LineInterval := TextHeight + (TextHeight div 2);
   LinesPerPage := (Printer.PageHeight - TopMargin) div LineInterval;
   CurrentLine := 0;
 end;

 function MorePages:boolean;
 begin
   Result := (CurrentLine <  LinesOnDoc) and
             not Printer.Aborted;
 end;

 procedure StartPage;
 begin
   LineOnPage := 0;
   LineCoord := TopMargin;
 end;

 procedure NextPage;
 begin
   if MorePages then Printer.NewPage;
 end;

 function MoreLines:boolean;
 begin
   Result := (LineOnPage <  LinesPerPage) and
             (LineOnPage <  LinesOnDoc) and
             not Printer.Aborted;
 end;

 procedure NextLine;
 begin
   Inc(LineOnPage);
   Inc(LineCoord, LineInterval);
   Inc(CurrentLine);
 end;

 procedure PrintLine;
 begin
   Printer.Canvas.TextOut(LeftMargin, LineCoord, S.Strings[CurrentLine]);
 end;

begin
 Printer.Title := Title;
 Printer.BeginDoc;
 StartDoc;
 while MorePages do
 begin
   StartPage;
   while MoreLines do
   begin
     PrintLine;
     NextLine;
     Application.ProcessMessages;
   end;
   NextPage;
 end;
 Printer.EndDoc;
end;