
10.08.2008, 01:20
|
 |
Прохожий
|
|
Регистрация: 31.07.2008
Сообщения: 5
Репутация: 10
|
|
Код:
procedure TForm1.BitBtn1Click(Sender: TObject);
const text = 'Текст Текст Текст';
var
n : integer; // для цикла
buf, textimg : Tbitmap; // два временных изображения
begin
buf := Tbitmap.Create;
textimg := Tbitmap.Create;
// Создание изображения текста
with textimg do
begin
canvas.Font.Color := ClWhite;
Canvas.Font.Size := 12;
Width := textimg.Canvas.TextWidth(text) + 4;
Height := textimg.canvas.textheight(text) + 4;
Canvas.Brush.Color := RGB(120,120,120);
canvas.fillrect(rect(0,0,textimg.Width, textimg.Height));
Canvas.TextOut(2,2, text);
Transparent := true;
end;
// Теперь в цикле меняем координаты текста и вывводим его
for n := 0 to image1.Width do
begin
image1.Refresh;
buf.LoadFromFile('bitmap.bmp'); // здесь указать путь до картинки, загруженной в TImage
buf.Canvas.draw(n, 50, textimg);
image1.picture.Bitmap.canvas.Draw(0,0, buf);
sleep(10);
end;
buf.Free;
textimg.free;
end;
|