Poszarpane ikonki w TreeView

0

Pobieram ikonkę otwartego folderu (indeks 4) z shell32.dll:

procedure TForm1.ToolButton3Click(Sender: TObject);
var
  largeicon, smallicon: hicon;
  icon: ticon;
begin
  ExtractIconEx('Shell32.dll', 4, largeicon, smallIcon, 1);
  icon := TIcon.Create;
  icon.Handle := smallicon;
  ImageListTmp.AddIcon(icon);
  TreeView.Images := ImageListTmp;
  icon.Free;
end;

Wszystko niby działa, ale ikonki wyglądają tak: user image. Okropna czarna obwoluta! Tak samo brzydko wygląda to w ToolBarze. Natomiast Picture już wygląda normalnie!:

Image2.Picture.Icon := icon;

Będę wdzięczny za pomoc.

0

Problem nie jest TreeView tylko ImageList

procedure ConvertTo32BitImageList(const ImageList: TImageList);
const
  Mask: array[Boolean] of Longint = (0, ILC_MASK);
var
  TempList: TImageList;
begin
  if Assigned(ImageList) then
  begin
    TempList := TImageList.Create(nil);
    try
      TempList.Assign(ImageList);
      with ImageList do
      begin
        Handle := ImageList_Create(Width, Height, ILC_COLOR32 or Mask[Masked], 0, AllocBy);

        if not HandleAllocated then
          raise EInvalidOperation.Create(SInvalidImageList);
      end;

      Imagelist.AddImages(TempList);
    finally
      FreeAndNil(TempList);
    end;
  end;
end;

Nie jest to kod napisyny przeze mnie, ale mam go na dysku a autor nieznam :(.

0

Dziękuję za pomoc :)
Odpowiedź też znalazłem na stronie http://4programmers.net/Delphi/FAQ/ImageList_niepoprawnie_wy%C5%9Bwietla_ikonki_XP._Co_robi%C4%87, ale tylko dzięki Tobie :)

1 użytkowników online, w tym zalogowanych: 0, gości: 1