procedure TForm4.Button1Click(Sender: TObject);
var IconIndex : Integer;
h : hIcon;
S :
String;
Icon : TIcon;
Bitmap : TBitmap;
OpenDialog : TOpenDialog;
lIndex: Integer;
begin
lIndex := Length(MeinArray);
SetLength(MeinArray, lIndex + 1);
MeinArray[lIndex].RealFileName := Form2.OpenDialog1.FileName;
MeinArray[lIndex].DisplayName := Form4.Edit1.Text;
Form2.ListBox1.Items.Add(MeinArray[lIndex].DisplayName);
Form2.ListBox1.MultiSelect :=False;
Form2.ListBox1.Sorted :=True;
Form2.Label2.Caption := OpenDialog.FileName;
Icon := TIcon.Create;
IconIndex := 0;
S := OpenDialog.FileName;
h := IconFromFile(OpenDialog.FileName,0);
Form2.ImageList1.AddIcon (Icon);
try
Form2.ImageList1.GetIcon(0, Icon);
Form2.Image1.Canvas.Draw(0, 0, Icon);
with
Form2.Image1.Canvas
Do
DrawIconEx(
Handle, 0, 0,h, 32, 32, 0, Brush.Handle, di_Normal);
begin
Form4.Close;
Edit1.Clear;
end;
finally
FreeAndNil(Icon);
end;
end;