WinAPI: LoadCursor - 从资源中载入光标


//声明:

LoadCursor(

  hInstance: HINST;   {EXE 或 DLL 的句柄, 0 表示载入系统资源}

  lpCursorName: PChar {资源标识符}

): HCURSOR;           {返回光标句柄}


 
   
这里有示例

//调用系统光标的例子:



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

  cur: TIcon;

begin

  cur := TIcon.Create;



  cur.Handle := LoadCursor(0, IDC_HAND);

  Canvas.Draw(11,11,cur);

  cur.Handle := LoadCursor(0, IDC_HELP);

  Canvas.Draw(44,11,cur);



  cur.Free;

end;



end.


 
   
//效果图:
WinAPI: LoadCursor - 从资源中载入光标

//附系统光标列表:

IDC_ARROW       = MakeIntResource(32512);

IDC_IBEAM       = MakeIntResource(32513);

IDC_WAIT        = MakeIntResource(32514);

IDC_CROSS       = MakeIntResource(32515);

IDC_UPARROW     = MakeIntResource(32516);

IDC_SIZE        = MakeIntResource(32640);

IDC_ICON        = MakeIntResource(32641);

IDC_SIZENWSE    = MakeIntResource(32642);

IDC_SIZENESW    = MakeIntResource(32643);

IDC_SIZEWE      = MakeIntResource(32644);

IDC_SIZENS      = MakeIntResource(32645);

IDC_SIZEALL     = MakeIntResource(32646);

IDC_NO          = MakeIntResource(32648);

IDC_HAND        = MakeIntResource(32649);

IDC_APPSTARTING = MakeIntResource(32650);

IDC_HELP        = MakeIntResource(32651);


 
   

你可能感兴趣的:(Cursor)