How to work with TsAlphaImageList at runtime?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #47246
    Support
    Keymaster

      Hello

      Try such code

      Code:
      sAlphaImageList1.Clear;
      sAlphaImageList1.Items.Clear;
      sAlphaImageList1.AcBeginUpdate;
      strm:=TFileStream.Create(JvFilenameEdit1.Text, fmOpenRead or fmShareDenyNone);
      with TsImgListItem(sAlphaImageList1.Items.Add) do
      begin
      ImageFormat := ifPNG;
      PixelFormat := pf32bit;
      ImgData.LoadFromStream(strm);
      end;
      strm.Free;
      sAlphaImageList1.AcEndUpdate(True {ImgList updated here if True});

      Maybe this demo will be interested for you :

      http://www.alphaskin…lyphsinskin.zip

      #47249
      ralfiii
      Participant

        This code doesn't do anything good.

        For adding images I found a solution:

        Code:
        with TsImgListItem(imgList.Items.Add) do
        begin
        ImageFormat := ifPNG;
        PixelFormat := pf32bit;
        ImgData.LoadFromStream(strmBinInDb);

        Png := TPNGGraphic.Create;
        Png.LoadFromStream(ImgData);
        Ico := MakeIcon32(Png);
        ImageList_AddIcon(imgList.Handle, Ico);
        DestroyIcon(Ico);
        FreeAndNil(Png);
        end;

        (…quite a lot of code…)

        but Clear still doesn't work at all.

        #47272
        Support
        Keymaster
          'ralfiii' wrote:
          but Clear still doesn't work at all.

          You uses this code?

          Code:
          sAlphaImageList1.Clear;
          sAlphaImageList1.Items.Clear;
          #47273
          ralfiii
          Participant

            Yes, I used

            Code:
            Caption:=IntTostr(sAlphaImageList1.Count);
            sAlphaImageList1.Clear;
            sAlphaImageList1.Items.Clear;
            Caption:=Caption+' – '+IntTostr(sAlphaImageList1.Count);

            And the result is “2 – 2”.

            So before and after 2 images.

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