paintbox.canvas.textout

3 отговора 75 прегледа
#1

paintbox.canvas.textout

Za po efektno prevyrtane na tekst izpolzvam slednija metod:
procedure TSplash.FormActivate(Sender: TObject);
var i,LineH:integer;
begin
with PaintBox1.Canvas do
begin
Font.Name:='Arial';
Font.Size:=20;
LineH:=TextHeight('0');
for i:=1 to LineH * 10 do
begin
Font.Name:= 'Arial';
Font.Color:=clBlue;
TextOut(40,200 - i,'neshto');
Font.Color:=clNavy;
TextOut(40,200 + lineh - i,'neshto');
Font.Name:='Monotype Corsiva';
Font.Color:=clRed;
TextOut(40,200 + lineh * 2 - i,'neshto');
TextOut(40,200 + lineh * 3 -i ,' ');
Delay (0,9);
end;
//MessageBeep(0);
end;
end;

procedure TSplash.Delay(Seconds, MilliSec: Word);
var TimeOut:TDateTime;
begin
TimeOut:= Now + EncodeTime(0, Seconds div 60,
Seconds mod 60, MilliSec);
while Now < TimeOut do
Application.ProcessMessages;
end;

Problemat tuk e che pri prevyrtaneto teksta premigva.
Kak bi mogyl da se reshi tozi problem?

Отговор
в отговор на zomb #2

Re: paintbox.canvas.textout

Не е най-доброто решение, но решава проблема с минимална промяна.
procedure TSplash.FormActivate(Sender: TObject);
var i,LineH:integer;
b: TBitMap; r: TRect;
begin
with PaintBox1.Canvas do
begin
b := TBitMap.Create;
b.Height := PaintBox1.Height;
b.Width := PaintBox1.Width;
b.canvas.Font.Name:='Arial';
b.canvas.Font.Size:=20;
LineH:=b.canvas.TextHeight('0');
r := Rect (0, 0, PaintBox1.Height-1, PaintBox1.Width-1);
for i:=1 to LineH * 10 do
with b.Canvas do
begin
Font.Name:= 'Arial';
Font.Color:=clBlue;
TextOut(40,200 - i,'neshto');
Font.Color:=clNavy;
TextOut(40,200 + lineh - i,'neshto');
Font.Name:='Monotype Corsiva';
Font.Color:=clRed;
TextOut(40,200 + lineh * 2 - i,'neshto');
TextOut(40,200 + lineh * 3 -i ,' ');

paintbox1.canvas.CopyRect (r, b.canvas, r);
Sleep (9);
end;
b.free;
end;

I have not failed. I've just found 10,000 ways that won't work.
Thomas A. Edison
Отговор
в отговор на zomb #3

Re: paintbox.canvas.textout

[линк]

-------------
Special killer double trouble triple extra nicotine monster!
Отговор
в отговор на zomb #4

Re: paintbox.canvas.textout

Blagodarq za infoto. Metoda s TPicture beshe po uspeshen.

Отговор