D
Delphids
Unregistered / Unconfirmed
GUEST, unregistred user!
在delphi中引用一个鼠标图标的资源文件,将程序运行起来以后,鼠标应该将变成我
在资源文件中画的样子,但是没有实现,请大家帮忙看看程序,问题出在哪里,谢谢!!
unit Unit1;
interface
{$R face.res}
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Menus;
type
TForm1 = class(TForm)
PopupMenu1: TPopupMenu;
procedure FormCreate(Sender: TObject);
procedure FormClick(Sender: TObject);
procedure FormKeyDown(Sender: TObject
var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
screen.cursors[1]:=LoadCursor(hInstance,pChar('Cursor1'));
screen.cursors[2]:=LoadCursor(hInstance,pChar('Cursor2'));
screen.Cursors[3]:=LoadCursor(hInstance,pChar('Cursor3'));
screen.cursors[4]:=LoadCursor(hInstance,pChar('Cursor4'));
screen.cursors[5]:=LoadCursor(hInstance,pChar('Cursor5'));
screen.cursor:=screen.Cursors[3];
end;
procedure TForm1.FormClick(Sender: TObject);
begin
screen.cursor:=screen.Cursors[1];
screen.cursor:=screen.Cursors[3];
screen.cursor:=screen.Cursors[2];
screen.cursor:=screen.Cursors[3];
screen.cursor:=screen.Cursors[4];
screen.cursor:=screen.Cursors[3];
screen.cursor:=screen.Cursors[5];
end;
procedure TForm1.FormKeyDown(Sender: TObject
var Key: Word;
Shift: TShiftState);
begin
if key = 13 then
begin
screen.Cursor := screen.Cursors[4];
screen.Cursor := screen.Cursors[3];
end;
if key = 44 then
begin
screen.Cursor := screen.Cursors[5];
screen.Cursor := screen.Cursors[3];
end;
end
end.
在资源文件中画的样子,但是没有实现,请大家帮忙看看程序,问题出在哪里,谢谢!!
unit Unit1;
interface
{$R face.res}
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Menus;
type
TForm1 = class(TForm)
PopupMenu1: TPopupMenu;
procedure FormCreate(Sender: TObject);
procedure FormClick(Sender: TObject);
procedure FormKeyDown(Sender: TObject
var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
screen.cursors[1]:=LoadCursor(hInstance,pChar('Cursor1'));
screen.cursors[2]:=LoadCursor(hInstance,pChar('Cursor2'));
screen.Cursors[3]:=LoadCursor(hInstance,pChar('Cursor3'));
screen.cursors[4]:=LoadCursor(hInstance,pChar('Cursor4'));
screen.cursors[5]:=LoadCursor(hInstance,pChar('Cursor5'));
screen.cursor:=screen.Cursors[3];
end;
procedure TForm1.FormClick(Sender: TObject);
begin
screen.cursor:=screen.Cursors[1];
screen.cursor:=screen.Cursors[3];
screen.cursor:=screen.Cursors[2];
screen.cursor:=screen.Cursors[3];
screen.cursor:=screen.Cursors[4];
screen.cursor:=screen.Cursors[3];
screen.cursor:=screen.Cursors[5];
end;
procedure TForm1.FormKeyDown(Sender: TObject
var Key: Word;
Shift: TShiftState);
begin
if key = 13 then
begin
screen.Cursor := screen.Cursors[4];
screen.Cursor := screen.Cursors[3];
end;
if key = 44 then
begin
screen.Cursor := screen.Cursors[5];
screen.Cursor := screen.Cursors[3];
end;
end
end.