1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
unit Ubmp;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
FMX.Controls.Presentation, FMX.StdCtrls, FMX.Objects, FMX.ScrollBox, FMX.Memo,
FMX.MultiresBitmap;
type
TForm8 = class(TForm)
Image1: TImage;
Button1: TButton;
Rectangle1: TRectangle;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form8: TForm8;
implementation
{$R *.fmx}
procedure TForm8.Button1Click(Sender: TObject);
var aBMP : TFixedBitmapItem;
begin
Rectangle1.Fill.Color:=TAlphaColorF.Create(random(255) / 255, random(255) / 255, random(255) / 255, random(255) / 255).ToAlphaColor;
if Image1.Bitmap.IsEmpty then
begin
try
aBMP:=Image1.MultiResbitmap.Add;
aBmp.Bitmap.Height:=40;
abmp.Bitmap.Width:=40;
Image1.Bitmap.Clear(Rectangle1.Fill.Color);
except
on E:Exception do memo1.Lines.Add(E.Message);
end;
end
else begin
Image1.Bitmap.Clear(rectangle1.fill.color);
end;
end;
end. |