【例子介绍】
【相关图片】
【源码结构】
unit PMain; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; Const crCursor1=1; crCursor2=2; crCursor3=3; crCursor4=4; type TForm1 = class(TForm) LoadCursor1: TButton; UninstallCursor: TButton; LoadCursor2: TButton; LoadCursor3: TButton; LoadCursor4: TButton; procedure FormShow(Sender: TObject); procedure LoadCursor1Click(Sender: TObject); procedure UninstallCursorClick(Sender: TObject); procedure LoadCursor2Click(Sender: TObject); procedure LoadCursor3Click(Sender: TObject); procedure LoadCursor4Click(Sender: TObject); private { Private declarations } public { Public declarations } Procedure InitialCursor; end; var Form1: TForm1; implementation {$R *.DFM} procedure TForm1.InitialCursor; var CursorPath:String; begin CursorPath:=ExtractFilePath(Application.ExeName); Screen.Cursors[crCursor1]:=LoadCursorFromFile(PChar(CursorPath 'Working.ani')); Screen.Cursors[crCursor2]:=LoadCursorFromFile(PChar(CursorPath 'Globe.ani')); Screen.Cursors[crCursor3]:=LoadCursorFromFile(PChar(CursorPath 'Hourglas.ani')); Screen.Cursors[crCursor4]:=LoadCursorFromFile(PChar(CursorPath 'In3d.ani')); end; procedure TForm1.FormShow(Sender: TObject); begin InitialCursor; end; procedure TForm1.LoadCursor1Click(Sender: TObject); begin Screen.Cursor:=crCursor1; end; procedure TForm1.UninstallCursorClick(Sender: TObject); begin Screen.Cursor:=crDefault; end; procedure TForm1.LoadCursor2Click(Sender: TObject); begin Screen.Cursor:=crCursor2; end; procedure TForm1.LoadCursor3Click(Sender: TObject); begin Screen.Cursor:=crCursor3; end; procedure TForm1.LoadCursor4Click(Sender: TObject); begin Screen.Cursor:=crCursor4; end; end.
评论