How to load imagelist with system dialog icons

旧时模样 提交于 2019-12-06 04:42:01

问题


How to load a TCustomImageList with all system icons used by Windows in dialog boxes (Standard icons like warning, error, information, confirmation..)?

I would like to find a solution which works on Windows XP and later.


回答1:


See LoadImage and LoadIcon.

Quick example:

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;


来源:https://stackoverflow.com/questions/36763562/how-to-load-imagelist-with-system-dialog-icons

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!