form的position属性为
poMainFormCenter

解决方案 »

  1.   

    谢谢各位,已解决.
    在Form2中定义变量
      private
        { Private declarations }
            iTop,iLeft : integer;
        procedure wmnchittest(var msg:twmnchittest);
        message wm_nchittest;procedure TForm2.wmnchittest(var msg:twmnchittest);
    begin
    inherited;
      if (msg.result=htcaption) and (Form2.Position <> poScreenCenter) then
        begin
       Form2.Top:= iTop;
       Form2.Left:= iLeft;
        end;
    end;procedure TForm2.FormCreate(Sender: TObject);
    begin
      iTop:=  Form2.Top;
      iLeft := Form2.Left;
    end;