先將窗口的BorderStyle設為bsNone,FormStyle設為fsStayOnTop。
procedure TForm3.CreateParams(var Params:TCreateParams);
begin
inherited;
with Params do
begin
Style:=Params.Style xor WS_DLGFRAME;
WndParent:=0;//此行
end;
end;
procedure TForm3.FormCreate(Sender: TObject);
begin
Width:=36;
Height:=36;
SetWindowLong(Handle,GWL_EXSTYLE,WS_EX_TOOLWINDOW);
end;