随笔 - 2146  文章 - 97 评论 - 11767 trackbacks - 253

//声明:
LoadIcon(
  hInstance: HINST; {EXE 或 DLL 的句柄, 0 表示载入系统资源}
  lpIconName: PChar {资源标识符}
): HICON;           {返回图标句柄}

这里有示例
//调用系统图标的例子:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  ico: TIcon;
  i,x: Integer;
begin
  ico := TIcon.Create;
  x := 10;
  for i := 32512 to 32517 do
  begin
    ico.Handle := LoadIcon(0, MakeIntResource(i));
    Canvas.Draw(x,10,ico);
    Inc(x,ico.Width+10);
  end;
  ico.Free;
end;

end.

//效果图:

//附系统图标列表:
IDI_APPLICATION = MakeIntResource(32512);
IDI_HAND        = MakeIntResource(32513);
IDI_QUESTION    = MakeIntResource(32514);
IDI_EXCLAMATION = MakeIntResource(32515);
IDI_ASTERISK    = MakeIntResource(32516);
IDI_WINLOGO     = MakeIntResource(32517);
IDI_WARNING     = IDI_EXCLAMATION;
IDI_ERROR       = IDI_HAND;
IDI_INFORMATION = IDI_ASTERISK;

posted on 2008-02-15 22:22  万一  阅读(...)  评论(...编辑  收藏