The program slowly outputs a text file on the screen, and then outputs from the head cycle after full output.
Source code (still not perfect) can be used after the modification, it is easy to implement, easy to make mistakes): Unit unit1; InterfaceUses Windows, Messages, Sysutils, Classes, Graphics, Controls, Forms, Dialogs, stdctrls, ExtCtrls, ComCtrls, ColorGrd, RxCombos; type TForm1 = class (TForm) Button1: TButton; Edit1: TEdit; OpenDialog1: TOpenDialog; Button2: TButton; Button3: TButton; TrackBar1: TTrackBar; Panel1: TPanel; Panel2: TPanel; Panel3: TPanel ; Label1: TLabel; Label2: TLabel; Timer1: TTimer; Button4: TButton; ColorDialog1: TColorDialog; FontDialog1: TFontDialog; Button6: TButton; Button7: TButton; ComboBox1: TComboBox; Panel4: TPanel; Edit2: TEdit; Edit3: TEdit; Label3 : TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; Edit4: TEdit; Edit5: TEdit; Button8: TButton; Button5: TButton; procedure Button1Click (Sender: TObject); procedure FormCreate (Sender: TObject); procedure Timer1Timer ( Sender: TOBJECT); Procedure Button2Click (Sender: TOBJECT); Proce dure Button3Click (Sender: TObject); procedure TrackBar1Change (Sender: TObject); procedure FormDestroy (Sender: TObject); procedure Button4Click (Sender: TObject); procedure Button7Click (Sender: TObject); procedure Button6Click (Sender: TObject); procedure Button8Click (Sender: TObject); procedure Button5Click (Sender: TObject); private procedure zShowText; Procedure zBmpCreate; procedure zSetBmp; procedure zSetLineHeight; procedure zShowLine (sender: TObject); {Private declarations} public {public declarations} end; var Form1: TForm1 Implementation {$ r * .dfm} const bwidth = 200; Var Currline, LineHeight: Integer; SITEM: TSTRINGLIST; BMP: TBITMAP
bRect, R1: TRect; iDc: HDC; procedure TForm1.Button1Click (Sender: TObject); beginOpenDialog1.Execute; Edit1.Text: = OpenDialog1.FileName; end; procedure TForm1.FormCreate (Sender: TObject); begin Form1.WindowState: = wsmaximized; panel1.top:=80; Panel1.heft: = 96; panel1.height: = 385; Panel1.Width: = 433; Timer1.Enabled: = false; label2.caption: = '100'; IDC: = GetDc (Panel1.handle); Currline: = 0; end; procedure TForm1.zShowLine (sender: TObject); begin zShowText; end; procedure TForm1.Timer1Timer (Sender: TObject); begin zShowLine (self); // the display string // bitblt transfer rectangular diagram (target handle, LS X, Y, wide, high, source handle, LS X, Y, raster operator) Bitblt (IDC, 0, 0, panel1.width, panel1.height, bmp.canvas .Handle, 0, currine, srcopy; inc (currline, 1); if currline> = BRECT.BOTTOM-PANEL1.HEIGHT 100 THEN / / Circulation Condition? begin Timer1.Enabled: = False; Currline: = 0; end; end; procedure TForm1.zShowText; var i: integer; ss: string; ReadFile: TextFile; begin AssignFile (ReadFile, Edit1.Text); Reset (ReadFile); I: = 1; Sitem: = TstringList.create; with site do whele not eof (readfile) DO begin readln (readfile, ss); add (ss); i: = i 1; end; closefile (readfile); zbmpcreate Sitem.free; // Release string end; procedure tform1.zbmpcreate; // Create a picture VAR i, Y: Integer; // YBEGIN if Bmp <> nil dam.create; zsetbmp; r1 .Right: = BRECT.Right; r1.bottom: = BRECT.BOTTOM; Y: = panel1.height-100; for i: = 0 to Sitem.count-1 do // From 0 to row number cycles display picture Begin R1 .Top: = y; r1.bottom: = r1.top lineheight; if ComboBox1.text = 'Intermediate alignment'
THEN / / Show picture drawtext (bmp.canvas.handle, pchar (Sitem [i]), - 1, r1, dt_center or dt_top) else if ComboBox1.text = 'left align' Ten DrawText (bmp.canvas.handle, Pchar (Sitem [I]), - 1, R1, DT_LEFT OR DT_TOP) ELSE IF ComboBox1.text = 'Right Align' Ten Drawtext (bmp.canvas.handle, Pchar (Sitem [i]), - 1, R1, DT_Right OR OR DT_TOP) Else DrawText (bmp.canvas.handle, pchar (Sitem [i]), - 1, R1, DT_Center OR DT_TOP); Inc (Y, LineHeight); End; End; Procedure TFORM1.ZSETBMP; Begin ZsetLineHeight; with BRECT DO // Rect rectangular coordinates (left X, lower left y, upper right x, right y) begin top: = 0; Left: = 0; Right: = panel1.width; bottom: = lineheight * Sitem.count height; / / Row * Row Form Height End; with bmp Do Begin Height: = BRECT.BOTTOM 100; // Picture Height Width: = BRECT.RIGHT; WITH CANVAS DO // Canvas Canvas Begin Font: = fontdialog1.font; //Font:=self.font;//form set font brush.color: = colorDialog1.color; fillRect (BRECT); brush.style =bsclear; end; end; end; procedure tForm1.zsetLineHeight; {setting Row interval} var metrics: ttextmetric; // Set font APIBEGIN G etTextMetrics (iDc, Metrics); LineHeight: = Metrics.tmHeight Metrics.tmInternalLeading-Bmp.Canvas.Font.Height; end; procedure TForm1.Button2Click (Sender: TObject); beginif Edit1.Text = '' then ShowMessage ( 'please Enter file address') Elsebegin if button2.caption = 'Start' Ten Button2.caption: = 'Pause' Else Button2.caption: = 'Start'; Timer1.enabled: = NOT TIMER1.Enabled; end; end; procedure tform1. Button3Click (Sender: TObject); begin timer1.Enabled: = false; Currline: = 0; Button2.Click; Button2.Caption: = 'pause'; end; procedure TForm1.TrackBar1Change (Sender: TObject); begin Timer1.Interval: = Trackbar1.position * 5;
Label2.Caption: = inttostr (Timer1.Interval); end; procedure TForm1.FormDestroy (Sender: TObject); begin if Bmp <> nil then Bmp.Free; end; procedure TForm1.Button4Click (Sender: TObject); beginclose; end ; procedure TForm1.Button7Click (Sender: TObject); beginFontDialog1.Execute; end; procedure TForm1.Button6Click (Sender: TObject); beginColorDialog1.Execute; end; procedure TForm1.Button8Click (Sender: TObject); begin if ((strtoint (Edit2 .Text)> = 600) OR (strt ") or 553) or 553) or 630)))) The showMessage (' Range super ') else begin panel1.top:=strtoint (Edit2.text); panel1.text: = start (edit3.text); Panel1.Width: = strt (edit4.text); panel1.height: = start ( Edit5.text); end; end; procedure tForm1.button5click (sender: TOBJECT); begin panel1.top:=0; panel1.wid: = 0; Panel1.Width: = Panel3.Width; Panel1.Height: = Panel3. Height; end; end. Detailed discussion in: http://www.9cbs.net/expert/topic/97/97371.shtm