- This topic has 1 reply, 2 voices, and was last updated 14 years, 11 months ago by Support.
-
AuthorPosts
-
November 30, 2009 at 2:00 pm #33427schwa226Participant
Hi,
I just have a question what is the maximum images (AddIcon) for TsAlphaImageList?
Because my program fails if more than 80 images are added!
Is there a way to increase this limit?
CODEprocedure TsAlphaImageList.Change;
var
Ico, NewIco: HICON;
iInfo : TIconInfo;
Bmp : TBitmap;
X, Y : integer;
BmpLine : PRGBAArray;
i, c, h, w : integer;
b : boolean;
begin
if AcChanging then Exit;
inherited;
if HandleAllocated and not (csLoading in ComponentState) and StdListIsGenerated then begin
if not (csDesigning in ComponentState) then begin
if IsDuplicated and (Count <= Items.Count) {If icon was not added using AddIcon or other std. way (not stored in Items)} then begin
if (Count < Items.Count) then begin
AcChanging := True;
GenerateStdList;
AcChanging := False;
end;
end
else begin
c := ImageList_GetImageCount(Handle) – 1;
if c > -1 then begin
Bmp := TBitmap.Create;for i := 0 to c do begin
Ico := ImageList_GetIcon(Handle, i, ILD_NORMAL);
GetIconInfo(Ico, iInfo);
Bmp.Handle := iInfo.hbmColor;
Bmp.HandleType := bmDIB; <--- ERROR: Invalide Parameter if c=81, i=20!
b := False;
h := Bmp.Height – 1;
w := Bmp.Width – 1;
Bmp.PixelFormat := pf32bit;
for Y := 0 to h do begin // Check if AlphaChannel is empty
BmpLine := Bmp.ScanLine[Y];
for X := 0 to w do if BmpLine[X].A <> 0 then begin
b := True;
Break;
end;
if b then Break;
end;
if not b then begin
for Y := 0 to h do begin
BmpLine := Bmp.ScanLine[Y];
for X := 0 to w do if BmpLine[X].C <> sFuchsia.C then BmpLine[X].A := $FF;
end;
iInfo.hbmColor := Bmp.Handle;
NewIco := CreateIconIndirect(iInfo);
DeleteObject(Ico);
ImageList_ReplaceIcon(Handle, i, NewIco);
end;DeleteObject(iInfo.hbmColor);
DeleteObject(iInfo.hbmMask);
end;Bmp.Free;
end;
end;
end;
end;
end;thx
December 8, 2009 at 2:53 pm #41204SupportKeymasterHello
I will research a problem, please wait a few days.
-
AuthorPosts
- You must be logged in to reply to this topic.