var
i: Integer;
Large, Small: HICON;
nIcons: Integer;
begin
if OpenDialog1.Execute then
begin
self.Image1.Canvas.Refresh;
nIcons:=ExtractIconEx(PChar(OpenDialog1.FileName), -1, Large, Small, 1);
for i:=0 to nIcons-1 do
begin
ExtractIconEx(PChar(self.OpenDialog1.FileName), i, Large, Small, 1);
DrawIcon(self.Image1.Canvas.Handle,(i div 4)*40,(i mod 4)*40,Large);
end;
end;
end;
转载于:https://www.cnblogs.com/tecsoon/archive/2009/03/27/1423768.html