Hi,
I posted several months ago on the Forum there. (perry4916)
and no response. so yes, I mean the Forum seems to be dead. Don't know about the program itself.
To Benjamin
"
Just an idea: Have you tried using several imagelists? You can then assign them in OnGetImageIndexEx. "
I guess I don't know how to use the "ongetimageindexex" ?
problem i was having at that time is
that i have 4700 icons.
when i am loading them into a Timagelist, it takes a looooong time, and i will get "out of resources" error.
So, I created a cache file (basicly 1 BMP) that had all the images next to eachother.
the filesize became 10 Mb and the image size was something like 4302249 x 23943
I was able to read that 1 picture into a timagelist and it automaticly splits the images for me.
but then also, i was getting randomly weird errors, "out of memory" "out of resource" etc
so I gave up.
So i am trying to find the best solution for it.
So now I have this on a event
and works great. but when you move the mouse, it's showing other icons on top of the 1 row i selected.
cause it's getting triggered everytime i move the mouse.
and if your going to fast it's not getting the proper X,Y information
Delphi-Quellcode:
procedure Tdsmainform.perrytreeAfterItemPaint(Sender: TBaseVirtualTree;
TargetCanvas: TCanvas; Node: PVirtualNode; ItemRect: TRect);
procedure DrawIcon;
var
w, X, Y, i: Integer;
BlobStream: TStream;
Datap: ptreedata;
begin
try
statusbar.caption:=inttostr(y);
Datap := Sender.GetNodeData(Node);
imagequery.SQL.Clear;
imagequery.SQL.Text:= 'SELECT * FROM pic where romnumber = "'+datap.romscenenumber+'"';
imagequery.Open ;
imagequery.first;
if imagequery.RecordCount=0 then exit;
if imagequery.FieldByName ('picc').IsNull then exit;
tempBmp.Width := 32;
tempBmp.Height := 32;
//tempbmp.PixelFormat := pf24Bit;
BlobStream := imagequery.CreateBlobStream(imagequery.FieldByName('picc'),bmRead);
try
apng.LoadFromStream(BlobStream);
finally
BlobStream.Free;
end;
tempBmp.Canvas.Draw(0, 0, aPng);
resizebmp(tempbmp,newiconbmp,24,24);
X := ItemRect.Left + TVirtualStringTree(Sender).Margin;
Y := ItemRect.Top + 2;
if perrytree.Header.Columns.Items[0].CaptionText='Icon' then x:=x+ perrytree.Header.Columns.Items[0].Left;
TargetCanvas.Draw(X, Y, newiconbmp);
except
on E: EStreamError do ShowMessage(lang1108);
on E: EInvalidGraphic do ShowMessage(lang1109);
end;
end;
begin
DrawIcon;
end;