Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi BUG in VT with Timagelist ? (https://www.delphipraxis.net/147296-bug-vt-timagelist.html)

perry4916 5. Feb 2010 04:01


BUG in VT with Timagelist ?
 
I'm thinking this is a bug

When i have a Timagelist with 20 icons in it and connect the Imagelist
to VT, then once the list is shown, The icon for Node 3-10 is the same.
1-2 and 11-20 are all different ones.

the weird thing is when, I put a TJImageviewer on my form
and connect the VT.images list to the Imageviewer, then everything
shows fine. but VT seems to have a problem

this is what i am using for the event

Delphi-Quellcode:
procedure Tdsmainform.treeGetImageIndex(Sender: TBaseVirtualTree;
  Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
  var Ghosted: Boolean; var ImageIndex: Integer);
var
Data: PTreeData;
begin
Data := Sender.GetNodeData(Node);
if Column = 0 then imageindex:=data.imagenumber-1;
end;
unless i am doing something wrong ?
The column=0 is for putting the icon in the 1st column in my tree.

Gollum 5. Feb 2010 08:28

Re: BUG in VT with Timagelist ?
 
Hallo,

I always had this problem, but I found the solution in the Demo-Program of the VT.

Use the function below in the OnCreate-Event of your Form:
Delphi-Quellcode:
uses
  Controls, CommCtrl;

// To show smooth images we have to convert the image list from 16 colors to high color.
procedure ConvertToHighColor(ImageList: TImageList);
var IL:TImageList;
begin
  // Have to create a temporary copy of the given list, because the list is cleared on handle creation.
  IL:=TImageList.Create(nil);
  try
    IL.Assign(ImageList);
    with ImageList do
      Handle:=ImageList_Create(Width, Height, ILC_COLOR16 or ILC_MASK, Count, AllocBy);
    ImageList.Assign(IL);
  finally
    IL.Free();
  end; // try
end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 16:09 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz