home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / delphi / cbsuite.lzh / SU1SRC.ZIP / FDEMO11.PAS < prev    next >
Pascal/Delphi Source File  |  1996-06-21  |  1KB  |  63 lines

  1. unit Fdemo11;
  2.  
  3. interface
  4.  
  5. uses WinTypes, WinProcs, Classes, Graphics, Forms, Controls, Buttons,
  6.   StdCtrls, ExtCtrls, Printers, PrnWin, CB_Types, CB_MFunc;
  7.  
  8. type
  9.   TForm11 = class(TForm)
  10.     CancelBtn: TBitBtn;
  11.     Bevel1: TBevel;
  12.     ListBox1: TListBox;
  13.     preview: TBitBtn;
  14.     PrintWin1: TPrintWin;
  15.     Panel1: TPanel;
  16.     Label2: TLabel;
  17.     Shape1: TShape;
  18.     procedure previewClick(Sender: TObject);
  19.     procedure FormActivate(Sender: TObject);
  20.   private
  21.     { Private declarations }
  22.   public
  23. end;
  24.  
  25. var
  26.   Form11: TForm11;
  27.  
  28. implementation
  29.  
  30. {$R *.DFM}
  31.  
  32.  
  33. procedure TForm11.previewClick(Sender: TObject);
  34. var
  35.     i: Integer;
  36.    y: Real;
  37. begin
  38.     PrintWin1.BeginPrint;
  39.     PrintWin1.NewFont ('Arial', 20, True, True, True);
  40.     PrintWin1.DrawWindow (1,poCenter, Panel1);
  41.  
  42.    y := 2.0;
  43.    for i := 1 to ListBox1.Items.Count-1 do begin
  44.      PrintWin1.NewFont (ListBox1.Items[i], 16, False, False, False);
  45.        PrintWin1.Drawtext( y,poLeft,  ListBox1.Items[i]);
  46.        PrintWin1.Drawtext( y,poCenter,  ListBox1.Items[i]);
  47.        PrintWin1.Drawtext( y,poRight,  ListBox1.Items[i]);
  48.       y := y+0.2;
  49.       if y > PrintWin1.PageHeight-1 then begin
  50.           PrintWin1.NewPage;
  51.          y := 2.0;
  52.       end;
  53.    end;
  54.     PrintWin1.EndPrint;
  55. end;
  56.  
  57. procedure TForm11.FormActivate(Sender: TObject);
  58. begin
  59.     ListBox1.Items := Printer.Fonts;
  60. end;
  61.  
  62. end.
  63.