Delphi program window animation and normal arrangement of tile

xiaoxiao2021-03-06  56

Note: This article has a better way, released on September 16, 2004 later

Delphi is indeed a very strong RAD tool, so I don't think that "defect" is not to affect the status of "defects" below. On the contrary, everyone will find that it is indeed a Very strong RAD tool. First come and see two pictures, compare them different.

The left is the task bar menu of HTMLVIEWER, which is the same as the menu that pops up on the window title bar. One is a standard Delphi program on the right. It can be seen that the menu that pops up on the taskbar is the menu of the Tapplication object. By default, it only has three: restore, minimize and close.

Of course, the menu is not the same as the key, the difference is that two points: 1, in Delphi 3.0 and Delphi 4.0, when the program like the right picture is minimized and restored, the window is instantaneous, and there is no image with VC. Or the procedure prepared by developing tools such as VB (not, after Inprise realized this problem, Delphi 5.0 has been resolved).

2. The three versions of the Delphi I have used are unable to arrange tiles in the standard Windows program (this is the most important), because with the Tapplication object, I guess, windows will When the Delphi program and other window on the desktop are arranged, the application handle is obtained, not the handle of the program main window, and the TAPPLICATION object is a special window with no height and width, so the problem will come out.

-------------------------------------------------- -------------------------------------------------- --------

In fact, I originally didn't want to solve these two problems in my mind. On the contrary, the experience is quite casual.

Once I saw "Delphi 3 from getting started to proficiency" learning writing notification bar programs, the examples of the book first use a way to make the application not displayed on the taskbar, and then explain that in the process of application, there is one Instantly, you will see it generated on the taskbar (especially when the machine is slower), this seems not professional. So Marco Cantu ("Delphi 3 from the author of the introduction" book is used to declare the application as a dynamic link library before all windows initialize, wait until Application.Initialize execution, and then restore it to normal applications. statement. Because the dynamic link library is not an application, there is basically eliminated the generation process of the application on the taskbar.

Of course I do. However, I suddenly found that my program has a window system menu and it has become the same in the system menu that pops up on the taskbar, so I realized that I realized that I am likely to make I want. .

Of course, there is still a lot, simply say: After I tried a variety of situations, I finally found a way to solve the top of the first question (interesting is that my Delphi program can be Normal arrangement of tiles I didn't think of it in advance).

-------------------------------------------------- -------------------------------------------------- --------

OK, I said so much, the solution is taken out, the steps are as follows: This article example Source code download: 1.88K1, New Application, save it, assume that Form1 is saved as "virmain.pas" (It is recommended not to save as main. " Name, because it is not a main form, it can be useless in actual programming). 2, New form, generate form2 (this is the main form).

3, new unit, add: Initialization islibrary: = true;

4. Save all, for the project, Unit1 recommends name "runfirst.PAS", and the main window Form2 is saved as "main.pas".

5. Open the project file, move "Runfirst In 'Runfirst.PAS';" one sentence to the first line, and add two words below the application.initialize statement, as follows: Program Project1;

Uses runfirst in 'Runfirst.PAS', // Note the semicolon to the comma Forms, virmain in 'virmain.pas' {form1}, main in 'main.pas' {form2};

{$ R * .res}

begin Application.Initialize; Application.ShowMainForm: = false; islibrary: = true; Application.CreateForm (TForm1, Form1); Form2: = TForm2.Create (Application); Form2.Show; Form2.Update; Application.Run; end.

6. Write the following statement in the ONCLOSE event in Form2: Procedure TFORM2.MMCLOSE (Sender: Tobject; VAR Action: Tclosection); begin application.terminate end;

Posted in "Agan's Home" August 14, 2000

转载请注明原文地址:https://www.9cbs.com/read-116456.html

New Post(0)