如何使用系统对话框图标加载图像列表

时间:2016-04-21 08:09:47

标签: delphi winapi icons standard-icons

如何在对话框中加载TCustomImageList以及Windows使用的所有系统图标(标准图标,如警告,错误,信息,确认......)?

enter image description here

我想找到适用于Windows XP及更高版本的解决方案。

1 个答案:

答案 0 :(得分:6)

请参阅LoadImageLoadIcon

快速举例:

procedure TForm1.Button2Click(Sender: TObject);
var
  t_Icon: TIcon;

begin
  t_Icon := TIcon.Create();
  t_Icon.Handle := LoadImage( 0, MAKEINTRESOURCE(32513), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE or LR_SHARED );

  if ( t_Icon.Handle <> 0 ) then
    ImageList1.AddIcon( t_Icon );

// .............

  t_Icon.Free();
end;