We can often see a lot of lively and interesting animation mouse, in fact, the use of Delphi powerful features, we can freely produce a personal characteristics of the mouse. I have made a animated mouse called Face, in the normal time, it is a round of faces, on the face of a pair of gurgling big eye. When the left (right) key is pressed, the left (right) eye of the face blinks. If you keep holding down, the left (right) eye blinks non-stop. Below I take this animated mouse as an example, briefly describes how to make an animated mouse.
First, select the Image editor under Delphi's main Menu tool, Edit a resource file named Face.res, it should include a personal production of five. cur files: faceleft.cur (pictured: a round face with a two-way left-looking eye), Faceright.cur (pictured: round face with a pair of eyes on the right), Plainface.cur (pictured: round face on a two-way Eyes), Leftshrink.cur (pictured: a round face with a left eye closed), Rightshrink.cur (pictured: a round face with a right eye closed).
After doing the resource file, open a new form FORM1 and place the PopupMenu component, and popupmenu the FORM1 attribute to PopupMenu1. Then add the following code under the interface section of UNIT1:
{$ R face.res}
并在TForm1.FormCreate事件内加入以下代码:
screen.cursors[1]:=LoadCursor(hInstance, pChar(′lfaceleft′));
screen.cursors[2]:=LoadCursor(hInstance, pChar(′faceright′));
screen.cursors[3]:=LoadCursor(hInstance, pChar(′plainface′));
screen.cursors[4]:=LoadCursor(hInstance, pChar(′leftshrink′));
screen.cursors[5]:=LoadCursor(hInstance, pChar(′rightshrink′));
screen.cursor:=plainface;
在TForm1.FormClick事件内加入以下代码:
screen.cursor:=faceleft;
screen.cursor:=plainface;
在TForm1.FormKeyDown事件内加入以下代码:
if button=MbLeft then
begin
screen.cursor:=leftshrink;
screen.cursor:=plainface;
end;
if button=MbRight then
begin
screen.cursor:=rightshrink;
screen.cursor:=plainface;
end;
……
Please add the rest of the details to the reader. Finish everything, run it, generate the EXE file, ok! a fun animation mouse on the compilation, run it you can see a lively and humorous round face. Of course, you can also design any other interesting animated mouse according to your liking and imagination.