| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- unit Unit1;
- {$mode objfpc}{$H+}
- interface
- uses
- Classes, SysUtils, Forms, Controls, Graphics, Dialogs, BCGradientButton,
- BCButton, BGRABitmap, BCTypes, BGRABitmapTypes;
- type
- { TForm1 }
- TForm1 = class(TForm)
- BCGradientButton1: TBCGradientButton;
- procedure BCGradientButton1BeforeRedraw(Sender: TObject; Bitmap: TBGRABitmap
- );
- procedure FormCreate(Sender: TObject);
- procedure FormDestroy(Sender: TObject);
- private
- bmp: TBGRABitmap;
- public
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.lfm}
- { TForm1 }
- procedure TForm1.FormCreate(Sender: TObject);
- begin
- BCGradientButton1.BeginUpdate;
- BCGradientButton1.BorderSize := 4;
- BCGradientButton1.EndUpdate;
- bmp := TBGRABitmap.Create(Application.Location + 'image.png');
- end;
- procedure TForm1.FormDestroy(Sender: TObject);
- begin
- bmp.Free;
- end;
- procedure TForm1.BCGradientButton1BeforeRedraw(Sender: TObject;
- Bitmap: TBGRABitmap);
- begin
- Bitmap.Fill(clNavy);
- Bitmap.StretchPutImageProportionally(Rect(0, 0, Bitmap.Width, Bitmap.Height), TACenter, TLCenter, bmp, dmDrawWithTransparency);
- end;
- end.
|