I have a project that uses TBitbtn buttons and I load the Glyph with a simple image and set the transparent true;
This no longer works, tmAuto or fixed or
Below is a sample of creating a Tbitmap, filling it with Red, and then assigning it to a Tbitbtn button, setting the transparent mode etc.
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, Buttons;
type
{ TForm1 }
TForm1 = class(TForm)
BitBtn1: TBitBtn;
procedure FormCreate(Sender: TObject);
private
public
B:Tbitmap;
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
B:= TBitmap.Create;
B.SetSize(16,16);
B.Canvas.Brush.Color := clRed;
B.Canvas.FillRect(ClientRect);
BitBtn1.Glyph.Assign(B);
BitBtn1.Glyph.Transparent := true;
BitBtn1.Glyph.TransparentColor := clRed;
BitBtn1.Glyph.TransparentMode :=tmFixed;
B.Free;
end;
end.
What should happen here is you shouldn't see any image at all, what you get is a red square.
What should happen, even in Auto Mode, is the code samples the lower left corner of the image for the transparent color value.
This is Delphi compliant and has been that way as far as I can remember.
In manual mode, it uses the color indicated in the TransparentColor property
Neither work any more..
I just upgraded to 3.4, I don't know if 3.2 worked but the last time it did work, I was using 2.04 laz on this project.