[code=delphi]
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
if zhiding= false then
begin
// form1.FormStyle:=fsStayOnTop;//原置顶方法会导致窗体闪烁,而且闪烁后窗体内的webbrower控件无法正常显示网页
SetWindowPos(Form1.handle, HWND_TOPMOST, Form1.Left, Form1.Top, Form1.Width, Form1.Height, 0);
zhiding:=true;
//利用windows Api置顶 窗体不闪烁
end
else
begin
//form1.FormStyle:=fsNormal;
SetWindowPos(Form1.handle, HWND_NOTOPMOST, Form1.Left, Form1.Top, Form1.Width, Form1.Height, 0);
zhiding:=false;
end;
end;
[/code]
转载请注明:鸟儿博客 » delphi之窗体无闪烁置顶