I'm sorry, my english is not very good.
I need to use semi-transparent bitmap pictures in my D7 app. So, i should use XPManifest and ImageList version6 instead of 5.8 standard one. But in this case, I faced a problev: all images loses their transparency while I load them form stream!
type
TForm2 = class(TForm)
btn4: TButton;
btn5: TButton;
lst1: TbtkListView;
il1: TImageList;
btn1: TButton;
tlb1: TToolBar;
btn2: TToolButton;
btn3: TToolButton;
xpmnfst1: TXPManifest;
procedure btn4Click(Sender: TObject);
procedure btn5Click(Sender: TObject);
procedure btn1Click(Sender: TObject);
private
FS: TFileStream;
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.btn4Click(Sender: TObject);
var
Bmp : TBitmap;
ImageList: TbtkImageList;
begin
ImageList := TbtkImageList.Create(nil);
Bmp := TBitmap.Create;
FS := TFileStream.Create('c:\temp\1.cmp',fmCreate);
try
Bmp.LoadFromFile('c:\temp\1.bmp');
ImageList.Add(Bmp, nil);
FS.WriteComponent(ImageList);
finally
Bmp.Free;
end;
end;
procedure TForm2.btn5Click(Sender: TObject);
var
Bmp : TBitmap;
ImageList : TbtkImageList;
begin
ImageList := TbtkImageList.Create(nil);
Bmp := TBitmap.Create;
try
FS.Position := 0;
FS.ReadComponent(ImageList);
ImageList.GetBitmap(0, Bmp);
Bmp.SaveToFile('c:\temp\3.bmp');
finally
Bmp.Free;
ImageList.Free;
end;
end;
ImageListCreationCode:
constructor TbtkImageList.Create(AOwner: TComponent);
begin
inherited;
if HandleAllocated then
ImageList_Destroy(Handle);
Handle := ImageList_Create(32, 32, ILC_COLOR32, AllocBy, AllocBy);
end;
http://s020.radikal.ru/i720/1403/36/c2702a8b5c1a.png Before http://s001.radikal.ru/i195/1403/e2/1dd5ff14aa51.png After
Can somebody help me?