Implementation window from real transparent to disappear This is an example

xiaoxiao2021-03-06  18

unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class (TForm) Timer1: TTimer; procedure FormCreate (Sender: TObject); procedure Timer1Timer (Sender : TObject); private {Private declarations} public {public declarations} end; Const WS_EX_LAYERED = $ 00080000; LMA_COLORKEY = $ 00000001; LMA_ALPHA = $ 00000002; var Form1: TForm1; Step: integer; implementation {$ R * .dfm} procedure TForm1.FormCreate (Sender: TObject); var ExtStyle: LongInt; begin Step: = 255; ExtStyle: = GetWindowLong (Handle, GWL_EXSTYLE); SetWindowLong (Handle, GWL_EXSTYLE, ExtStyle or WS_EX_LAYERED); end; procedure TForm1.Timer1Timer (Sender: TObject); Begin if step: = step: = step-10; setlayeredWindowAttributes (Handle, RGB (0, 0), Step, LMA_ALPHA or LMA_COLORKEY); Else Begin SetlayeredWindowAttributes (Handle, RGB (0, 0, 0), 255, 1); Timer1.enabled: = false; end; end; end.

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

New Post(0)