Keep your form on the desktop

xiaoxiao2021-03-06  41

When we want a form to keep a form on the top of the desktop, you can define a form.

Formstyle

Property, keeps the form on the top. However, after using this method, the form will flash when switching the form of the form. In order to avoid flashing when switching the form mode, you can use

Windows API

function

SetwindowPOS

To solve this problem, the method is as follows:

Setwindowpos (Form1.handle, Hwnd_topmost, Form1.LiD, Form1.top, Form1.Width, Form1.Height, 0);

Instead of "Form1" with the actual form name, you can set the form to keep the form to the top of the desktop. To switch the form back to the normal form, call the following command:

Setwindowpos (Form1.Handle, Hwnd_Notopmost, Form1.Width, Form1.Height, 0);

(Source: http://www2.delphifans.com/blog/more.asp? Name = caixiaoming & id = 391)

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

New Post(0)