unit main;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, extctrls;
type
TForm1 =
class(TForm)
Edit1: TEdit;
Button1: TButton;
PaintBox1: TPaintBox;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure PaintBox1Paint(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
Txt:
String;
Procedure PaintTxt;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
Txt := Txt+#13#10+Edit1.Text;
Label1.Caption := Txt;
PaintTxt;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Txt := '
Test';
end;
Procedure TForm1.PaintTxt;
Var TxtRect: TRect;
pbRect: TRect;
Begin
pbRect := PaintBox1.ClientRect;
TxtRect := pbRect;
DrawText(PaintBox1.Canvas.Handle,PChar(Txt),Length(Txt),TxtRect,DT_CALCRECT);
TxtRect.Top := pbRect.Bottom-TxtRect.Bottom;
TxtRect.Bottom := pbRect.Bottom;
DrawText(PaintBox1.Canvas.Handle,PChar(Txt),Length(Txt),TxtRect,DT_LEFT);
End;
procedure TForm1.PaintBox1Paint(Sender: TObject);
begin
PaintTxt;
end;
end.