TsAlphaImageList max images? 80?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #33427
    schwa226
    Participant

    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?

    CODE
    procedure 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

    #41204
    Support
    Keymaster

    Hello

    I will research a problem, please wait a few days.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.