实现窗口从实变透明到消失这是一个例子

论坛 期权论坛 脚本     
已经选择匿名的用户   2021-6-10 14:10   3028   0
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>0 then begin Step:=Step-10; SetLayeredWindowAttributes(Handle, RGB(0,0,0), Step, LMA_ALPHA or LMA_COLORKEY); end else begin SetLayeredWindowAttributes(Handle, RGB(0,0,0), 255, 1); Timer1.Enabled:=False; end; end; end.
分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:86
帖子:240
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP