How to make your window Stay on top

xiaoxiao2021-03-06  40

In Delphi, the easiest way to make the form "Stayontop" is set to "FormStyle" attributes "fsStayont", but use this method, if the "FormStyle" property is set to other modes, window beat is flashing. In order to avoid this problem, here you can use the power of API to achieve the same functionality.

4.1 Setting the form as "Stayontop" style.

SetWindowPos (Form1.Handle

HWND_TOPMOST

Form1.Left

Form1.top

Form1.width

Form1.height

0);

The Form1 here is the name of your form

4.2, set the form to normal, non-TopMost style

SetWindowPos (Form1.Handle

HWND_NOTOPMOST

Form1.Left

Form1.top

Form1.width

Form1.height

0);

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

New Post(0)