以下是代码
unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,  ExtCtrls, ComCtrls, StdCtrls;  //第1步,加ExtCtrls, ComCtrls, StdCtrls;type
  TForm1 = class(TForm)
    Timer1: TTimer;
    Timer2: TTimer;    procedure Timer1Timer(Sender: TObject);
    procedure Timer2Timer(Sender: TObject);  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;implementation{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
var
  winPos: TPoint;
  t: integer;
  b: boolean;
  rc:TRect;
begin
  b:= false;
  if (form1.Top <= 3) then
  begin
    b:= true;
    t:= 0;
  end
  else if form1.Left + form1.Width - Screen.Width >= 0 then
  begin
    b:= true;
    t:= form1.Top;
  end
  else
    t:= form1.Top;
if b then
  begin
    GetWindowRect(self.Handle, rc); //取窗体的矩形区域
    //得到当前鼠标指针的在屏幕上的坐标
    GetCursorPos(winPos);
    
    if PtInRect(rc, winPos)  then
    
    begin
      //停用Timer2
      form1.timer2.Enabled:= false;
      form1.Top:= t;
      if t <> 0 then
        form1.Left:= Screen.Width - form1.Width;
    end
    else begin
      form1.Timer2.Enabled:= true;
    end;
  end;
end;//**********
procedure TForm1.Timer2Timer(Sender: TObject);
// 当 top 距屏幕上侧 20 像素时,自动隐藏
begin
if form1.Top <= 20 then
  begin
    //将form1向上移,在屏幕上方露出3像素
    form1.Top:= -(form1.Height - 3);
    if (form1.Left + form1.Width > Screen.Width) then
      form1.Left:= Screen.Width - form1.Width;
  end
  // 当 left 距屏幕下侧 20 像素时,自动隐藏
  else if form1.Left + form1.Width - Screen.Width >= -20 then
    //将form1向右移,在屏幕右方露出4像素
    form1.Left:= Screen.Width - 4;
end;
end.问题是我用的是1024X768的分辨率 然后把程序 停靠在右面 自动隐藏了。
以下是关键
我运行了星际争霸1.08B。。然后在退出就出现停靠在右面的窗体脱离了原来的位置~
以下是截图
左边那细条是停靠右面显示的边框 右边的是运行星际争霸后退出 显示的画面!
高手 HELP ME...