如何实现类似xp关机前屏幕慢慢变暗的效果? |
尚未結案
|
xxxxzxx
一般會員 發表:21 回覆:49 積分:24 註冊:2004-11-15 發送簡訊給我 |
|
xfile
初階會員 發表:21 回覆:80 積分:25 註冊:2004-10-02 發送簡訊給我 |
引言: 如?,??各位大大!提供一個懶人作法, BCB 6.0 版,Delphi 稍加轉換後應該可以比照辦理 材料 : Form 一個,WindowState 設成 wsMaximized AlphaBlend 設為 true ,並設 AlphaBlendValue 為 180 BorderStyle 設為 bsNone Timer 一個,Interval 設為 100,Tag 設為 255 然後貼上以下代碼 //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { DoubleBuffered = true ; Left = 0 ; Top = 0 ; } //--------------------------------------------------------------------------- void __fastcall TForm1::Timer1Timer(TObject *Sender) { if ( Timer1->Tag >= 0 ) { Color = Timer1->Tag Timer1->Tag*256 Timer1->Tag*256*256 ; Timer1->Tag-=5 ; } }發表人 - xfile 於 2005/03/22 19:19:29 發表人 - xfile 於 2005/03/22 19:20:23 發表人 - xfile 於 2005/03/22 19:23:01 |
xxxxzxx
一般會員 發表:21 回覆:49 積分:24 註冊:2004-11-15 發送簡訊給我 |
感谢~~这样的方法已经实现: 想知道还有其他的办法吗?
开始->关闭计算机--->出现关闭计算机对话框--->屏幕渐渐变暗---->鼠标无法操作桌面对象.(想要这样的效果) -----------------------------------------------------
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.
|
xfile
初階會員 發表:21 回覆:80 積分:25 註冊:2004-10-02 發送簡訊給我 |
引言: 感?~~??的方法已???: 想知道?有其他的?法?? ?始->???算机--->出????算机??框--->屏幕???暗---->鼠??法操作桌面?象.(想要??的效果)在原來的那個 From 裡面並沒有把 FormStyle 設為 fsStayOnTop, 這表示您可以再新增一個 FormStyle 為 fsStayOnTop 的 Form, 而且由於原來 Form 的 AlphaValue 不夠,所以也可以屏蔽掉所有桌面的操作, 您再加把勁把鍵盤按鍵鎖起來就可以達到 Windows 那種效果了 |
xxxxzxx
一般會員 發表:21 回覆:49 積分:24 註冊:2004-11-15 發送簡訊給我 |
|
xfile
初階會員 發表:21 回覆:80 積分:25 註冊:2004-10-02 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |