sAlphaImageList.Count D2010

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

    Ok, it looks like no bug to Delphi 2010, 2009…

    If you use AddIcon the Icon will be added, but no item will be added.
    If manually add icon also a item will be added.

    dirty workaround:

    CODE
      Function AddTIcon(var ImageList : TsAlphaImageList; const Icon : TIcon): Integer;
      var
        TempStream : TMemoryStream;
        NewItem : TsImgListItem;
      begin
        TempStream := TMemoryStream.Create;
        Result := -1;
        try
          Icon.SaveToStream(TempStream);
          NewItem := TsImgListItem.Create(ImageList.Items);
          NewItem.ImgData.SetSize(TempStream.Size);
          CopyMemory(NewItem.ImgData.Memory,TempStream.Memory,TempStream.Size);
          Result := ImageList.AddIcon(Icon);
        finally
          TempStream.Free;
        end;
      end;

    #41513
    Support
    Keymaster

    Hello
    Try to add “sAlphaImageList1.AcBeginUpdate” before adding icons and “sAlphaImageList.AcEndUpdate(True)” after adding.
    Items must be added automatically.

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