剽窃一个给你瞧瞧
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
{$R myres.res}//这一行必须有
procedure ZloadfromResourse(screenindex:integer;name
char);
var td:ticon;
begin
try
td:=ticon.Create;
td.Handle:=LoadIcon(Hinstance,name);
td.SaveToFile('temp.cur');
screen.Cursors[screenindex]:=loadcursorfromfile('temp.cur');
deletefile('temp.cur');
finally
td.free;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ZloadfromResourse(2,'icon1');//注意在资源文件中用大写 ICON1,你可以画出任意形状和颜色
Form1.cursor:=2;
end;
end.