zoukankan      html  css  js  c++  java
  • WinAPI: LoadIcon 从资源中载入图标

    //声明:
    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;
    
  • 相关阅读:
    Git
    系统设计基础
    Java框架之Hibernate(二)
    Java框架之Hibernate(一)
    Java框架之Spring MVC(二)
    Java框架之Spring MVC(一)
    Java框架之Spring(五)
    Java框架之Spring(四)
    Java框架之Spring(三)
    Spring中四种实例化bean的方式
  • 原文地址:https://www.cnblogs.com/del/p/1070227.html
Copyright © 2011-2022 走看看