使用LoadCursor或LoadCursorFromFile函数调入光标。然后调用该光标即可。
Eg:
Screen.Cursor[2] := LoadCursor(Hinstance ,'test') ;
Form1.Cursor := 2 ;
注:Test为资源字符串
Eg:
Screen.Cursor[2] := LoadCursor(Hinstance ,'test') ;
Form1.Cursor := 2 ;
注:Test为资源字符串
解决方案 »
- 在用OleContainer1打开excel 时,如何自动打开excel ,用要每次程序运行后,通过双击鼠标来打开excel
- 关于Crystal Report VCL 组件的应用 ( 报表的参数传递 )
- 这有什么区别?
- TdxDBMaskEdit如何在Enable:=False;時改變背景顏色?
- SQL SERVER 2000触发器问题
- dbgrid:请问如何获得用户选择的那个单元的值,并对此单元通过代码进行赋值.(注.此单元是我在dbgrid中新加的)
- 如何使某一个窗体在程序运行时第一个显示?
- 请介绍几个比较专业或比较热门的国外Delphi论坛
- 关于终止application的问题???在线等
- 错误信息
- 怎么让应用程序不出现在任务栏??
- 程序中拖动控件
用Image Editor编辑一个鼠游标(Fild | New | Resource File)新建一个 CURSOR_1 的 CURSOR, 设定好它的 Hot Spot(Cursor | Set Hot Spot)存档时注意要和建立的Project存在同一个目录
在本例我们先假定为 MyCursor.res
二. 程序部分
定义一个常数crMyCursor, 这个常数您必须设成大於零 的任何整数, 以 LoadCursor() 函数将自订的鼠标资源
load 进来, 以下为源代码:
// unit.pas
unit Unit1;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes,
Graphics, Controls, Forms, Dialogs;
const
crMyCursor = 1; (* 宣告一个常数 *)
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
{$R mycursor.res}//这行$R不可少, 否则自订的鼠游标就出不来了
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
//将鼠标资源 load 进来
Screen.Cursors[crMyCursor] := LoadCursor (hInstance,'CURSOR_1');
Cursor := crMyCursor;//指定 form1 的 cursor 为自订鼠标
Button1.Cursor := crMyCursor;//指定Button1的cursor为自订鼠标
end;
end.