Delphi Programming Fun Animation Mouse

Source: Internet
Author: User
Tags resource

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.