可以让窗口不透明的,我让它透明, 是为了让你更好的看到这种效果。<br>procedure TForm1.Button1Click(Sender: TObject);<br>const<br> WS_EX_LAYERED = $80000;<br> WS_EX_TRANSPARENT = $20;<br> LWA_ALPHA = $2;<br>var<br> OldStyle: Integer;<br>begin<br> OldStyle := GetWindowLong(Handle, GWL_EXSTYLE);<br> SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) or<br> WS_EX_LAYERED);<br> SetLayeredWindowAttributes(Handle, 0, [blue]255[/blue], LWA_ALPHA);<br> SetWindowLong(Handle, GWL_EXSTYLE, OldStyle or WS_EX_LAYERED or<br> WS_EX_TRANSPARENT or WS_EX_TOPMOST);<br>end;<br><br>//********************<br>unit Unit2;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, StdCtrls;<br><br>type<br> TForm2 = class(TForm)<br> Button1: TButton;<br> Button2: TButton;<br> procedure Button1Click(Sender: TObject);<br> procedure Button2Click(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form2: TForm2;<br><br>implementation<br><br>uses Unit1;<br><br>{$R *.dfm}<br><br>procedure TForm2.Button1Click(Sender: TObject);<br>var<br> OldStyle: Integer;<br>begin<br> //恢复原来的样子<br> OldStyle := GetWindowLong(Handle, GWL_EXSTYLE);<br> SetWindowLong(Form1.Handle, GWL_EXSTYLE, oldStyle);<br>end;<br><br>procedure TForm2.Button2Click(Sender: TObject);<br>begin<br> form1.Show;<br>end;<br><br>end.