урок на делфи 46 - Текст поверх рисунка


задание на delphi. пишим текст поверх рисунка


unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Image1: TImage;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
bmp: TBitMap;
{пояснение к программе https://youtu.be/n5uByuRBofo}
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
bmp.LoadFromFile('test.bmp');
Image1.Picture.Assign(bmp);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
bmp.Canvas.Font.Name := 'Times New Roman';
bmp.Canvas.Font.Color := clGreen;
bmp.Canvas.Font.Style := [fsBold];
bmp.Canvas.Font.Size := 50 ;
bmp.Canvas.Brush.Style := bsClear;
bmp.Canvas.TextOut(50, 100, 'dear-ruslan.ru');
Image1.Picture.Assign(bmp);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Image1.Picture.SaveToFile('bmp_new.bmp');
FreeAndNil(bmp);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
bmp := TBitMap.Create;
end;
end.



Скачать