//-------------------------------------------------------------------------
// Made by Richard Funke, 1999
// Delphi 4
//
// www.interkodex.com / www.joffa.com
//
// Code from Delphi Snippets : http://sortland.net/Delphi/Snippets.htm
//-------------------------------------------------------------------------
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure Render(Sender: TObject; var Done: Boolean);
    procedure FormResize(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation
var
  offbmp: TBitmap;
  Time, xx: Integer;

{$R *.DFM}


procedure TForm1.Render(Sender: TObject; var Done: Boolean);
begin
  Time := (Time + 1) mod 100;
  if Time = 0 then
    begin
      Inc(xx);
      Canvas.lock;
      with OffBmp.Canvas do
        begin
          Brush.Color := clBlack;
          Brush.Style := bsSolid;
          FillRect(bounds(0, 0, Width, Height));
          Font.Name := 'Arial black';
          Font.Size := Form1.Height div 3;
          Font.Color := clwhite;
          Brush.Style := bsClear;
          TextOut(Form1.Width - xx, 0,
             'Yet another flickerless text scroller! Made in delphi!');
        end;
      Application.ProcessMessages;
      Canvas.draw(0, 0, offbmp);
      // canvas.CopyRect(bounds(0,0,width,height),
      //   offbmp.canvas,bounds(0,0,width,height));
      // canvas.bitbl
    end;
  Done := False;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  offbmp := TBitmap.Create;
  offbmp.Width := Form1.Width;
  offbmp.Height := Form1.Height;

  with OffBmp do
    begin
      Canvas.Brush.Color := clBlack;
      Canvas.FillRect(bounds(0, 0, Width, Height));
    end;

  Application.OnIdle := render;
end;

procedure TForm1.FormResize(Sender: TObject);
begin
  offbmp.Width := Form1.Width;
  offbmp.Height := Form1.Height;
  with OffBmp do
    begin
      Canvas.Brush.Color := clBlack;
      Canvas.FillRect(bounds(0, 0, Width, Height));
    end;
end;

end.