如果要在delphi中使用自定义资源文件*.res文件,比如一个光标,此时可以采用下列步骤:
1,创建包含相应的资源文件,这里是创建一个包含自定义光标的res文件。
2,在主窗体的pas文件中加入编译指令,要求编译器将资源文件链接到最终文件中。
3,在FormCreate的时候加载资源并使用。
1 unit Unit1; 2 3 interface 4 5 uses 6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 7 Dialogs; 8 9 type 10 TForm1 = class(TForm) 11 procedure FormCreate(Sender: TObject); 12 private 13 { Private declarations } 14 public 15 { Public declarations } 16 end; 17 18 var 19 Form1: TForm1; 20 21 //加入编译指令 22 {$R custom.res} 23 implementation 24 25 {$R *.dfm} 26 27 procedure TForm1.FormCreate(Sender: TObject); 28 begin 29 Screen.Cursors[1] := LoadCursor(hInstance, ‘TEST‘); 30 Form1.Cursor := 1; 31 end; 32 33 end.
delphi中使用自定义资源的方法,布布扣,bubuko.com
原文:http://www.cnblogs.com/jimmymi/p/3621052.html