![]() |
probleme mit der ImageList
Hallo habe wie im Title schon angegeben probleme (mal wieder) mit der ImageList.
Dieses mal dieses: Die ersten 6 Icons sind müll - ab da an werden die Icons jeweils immer doppelt in die ImageList eingefügt.. Hier mein Code: als strPath: benutze ich 'C:\Windows\'
Delphi-Quellcode:
procedure LV_InsertFiles(strPath: string; ImageList: TImageList);
var i, hoo: Integer; Icon: TIcon; SearchRec: TSearchRec; FileInfo: SHFILEINFO; begin hoo := 0; i := 0; ImageList.Clear; try i := FindFirst(strPath + '*.*', faAnyFile, SearchRec); while i = 0 do begin if (SearchRec.Attr and FaDirectory <> FaDirectory) and (SearchRec.name <> '.') and (SearchRec.name <> '..') then begin Icon := TIcon.Create; DestroyIcon(FileInfo.hIcon); SHGetFileInfo(PChar(strPath + SearchRec.Name), 0, FileInfo, SizeOf(FileInfo), SHGFI_ICON or SHGFI_LARGEICON); icon.Handle := FileInfo.hIcon; Form1.Image1.Picture.Icon := Icon; inc(hoo); Form1.Label1.Caption := IntToStr(hoo); ShowMessage ( IntToStr( ImageList.AddIcon(Icon) )); Application.ProcessMessages; Icon.Free; end; i := FindNext(SearchRec); end; finally end; end; |
Re: probleme mit der ImageList
nachtrag:
habe rausgefunden das dies nur bei verwendung von
Delphi-Quellcode:
so ist!
{ try
SysIcons := SHGetFileInfo(PChar(copy(ParamStr(0), 1, 3)), 0, SHFileInfo, SizeOf(SHFileInfo), SHGFI_SYSICONINDEX or SHGFI_LARGEICON); finally DestroyIcon(SHFileInfo.hIcon); end; ImageList1.Handle := SysIcons;} Was mach ich denn nun? ich brauche obiges, damit die Icons "schön" sind! |
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:55 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz