form的 OnDeactivate 事件 SetWindowPos(Handle, HWND_TOPMOST, Left,Top, Width, Height, SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE); form 的OnActive:SetWindowPos(Handle, HWND_NOTOPMOST, Left, Top, Width, Height, SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE);
skin2003(freedomhua) :不要乱发广告。
var Form1: TForm1; oleft:Integer; otop:Integer; owidth:Integer; oheight:Integer; procedure TForm1.FormCreate(Sender: TObject); begin //记录原始位置 全局变量 oleft:=Left; otop:=Top; owidth:=width; oheight:=height; end;end; procedure TForm1.windowsposchange(var Msg:TWMWINDOWPOSCHANGING); begin // 恢复院士位置尺寸Msg.WindowPos.x:=oleft; Msg.WindowPos.y:=otop;Msg.WindowPos.cx :=owidth; Msg.WindowPos.cy:=oheight;inherited;end;
SetWindowPos(Handle, HWND_TOPMOST, Left,Top, Width,
Height, SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE);
form 的OnActive:SetWindowPos(Handle, HWND_NOTOPMOST, Left, Top, Width,
Height, SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE);
Form1: TForm1;
oleft:Integer;
otop:Integer;
owidth:Integer;
oheight:Integer;
procedure TForm1.FormCreate(Sender: TObject);
begin
//记录原始位置 全局变量
oleft:=Left;
otop:=Top;
owidth:=width;
oheight:=height;
end;end;
procedure TForm1.windowsposchange(var Msg:TWMWINDOWPOSCHANGING);
begin // 恢复院士位置尺寸Msg.WindowPos.x:=oleft;
Msg.WindowPos.y:=otop;Msg.WindowPos.cx :=owidth;
Msg.WindowPos.cy:=oheight;inherited;end;