也就是設它的絕對位置,如何做呢。

解决方案 »

  1.   

    eidt下方放个panel,创建form的parent设置为该panel
    --------------------------------------------------------------------
    看尽悲伤,庸人自扰不平事。叹尽荒凉,海阔天空谁人知。狂风劲兮,百花飘
    扬乱舞香。捏花一笑,海不扬波断肠心!
      

  2.   

    implementation
    uses unit2;procedure TForm1.Button1Click(Sender: TObject);
    begin
      form2.Top:=form1.Top+(form1.Height-form1.ClientHeight)+edit1.Top+edit1.Height;
      form2.ShowModal;
    end;
      

  3.   

    你看看吧!!!unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      StdCtrls;type
      TForm1 = class(TForm)
        Edit1: TEdit;
        procedure Edit1Click(Sender: TObject);
      private
        { Private declarations }
        Function GetScreenZB(var Ed:TEdit;Form:TForm):TPoint;
      public
        { Public declarations }  end;var
      Form1: TForm1;implementationuses Unit2;{$R *.DFM}Function TForm1.GetScreenZB(var Ed:TEdit;Form:TForm):TPoint;
    var
       iCont:TControl;
       xx,yy:integer;
       Ret:TPoint;
    begin
       xx:=ed.Left;
       yy:=ed.Top;
       iCont:=Ed;
       //
       while not(iCont is TForm) do
       begin
          iCont:=iCont.Parent;
          xx:=xx + icont.left;
          yy:=yy + iCont.Top;
       end;
       //
       xx:=xx + 4;
       yy:=yy + Ed.Height + 20;
       //
       if Screen.Width - xx <= Width then
       begin
          xx:= xx - (Form.Width - Ed.Width);
       end;
       if Screen.Height - yy <= Height then
       begin
          yy:= yy -  (Form.Height + Ed.Height) +4 ;
       end;
       //
       if xx<0 then xx:=0;
       //
       if yy<0 then yy:=0;
       //
       Ret.x:=xx;
       Ret.y:=yy;
       Result:=Ret;
    end;procedure TForm1.Edit1Click(Sender: TObject);
    var
      pp:Tpoint;
    begin
      pp:=GetScreenZB(edit1,Form2);
      form2.left:=pp.x;
      form2.top:=pp.y;
      form2.showmodal;
    end;end.