请教如何实现在程序运行的时候可以拖动组件。并把其坐标(x,y)记录下来,以便下次登录的时候可以恢复的上次的地方。

解决方案 »

  1.   

    这有相关资料
    http://www.cnread.net/cnread1/dnwl/cxsj/delphi/jcjc/023.htm
      

  2.   

    procedure Tmainfrm.SpeedButtonMouseMove(Sender: TObject;Shift: TShiftState; X, Y: Integer);
    var
      J:integer;
    begin
      if ControlSpeedButtonMove[b]=false then begin
        mybutton.Left:=x-ScrollBox1.HorzScrollBar.Position;
        mybutton.Top:=y-ScrollBox1.VertScrollBar.Position;
      end;
    end;
    如果要把坐标记录 下来的话  就得保存到数据库了    
    //可以移动了 
      
      ControlSpeedButtonMove[b]:=false;//不可以移动了 ControlSpeedButtonMove[b]:=true;