现在做一个模块窗体准备做成和QQ的自动隐藏效果一样,可不知道这是用的什么技术,请教.

解决方案 »

  1.   

    你可以将窗体的left,设置为 -form1.width;
               将top  设置为  -form1.height;
      

  2.   

    规定一个距离如len,在用户移动窗体的时候检查边框是否和屏幕边缘的距离小于len,如果小于,照楼上所说。
      

  3.   

    利用一个时钟控件随时判断窗体的位置,如果窗体的top或left达到一定的位置,隐藏窗体
    procedure TForm1.Timer1Timer(Sender: TObject);
    begin
      if form1.Top<=0 then
        form1.Top:=0-form1.Height+1;
      if form1.Left<=0 then
        form1.Left:=0-form1.Width+1;
      if form1.Left+form1.Width>=screen.DesktopWidth then
        form1.Left:=screen.DesktopWidth;
    end;
      

  4.   

    实现qq的自动隐藏窗口var
      oldwidth:integer;
      mousein:boolean=true;
      r:trect;procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    begin
      if not mousein then
      begin
        width:=oldwidth;
        r.right:=r.Left+oldwidth;
      end;
      mousein:=true;
    end;procedure TForm1.FormShow(Sender: TObject);
    begin
      left:=0;
      oldwidth:=width;
      r.Left:=left;
      r.Top:=top;
      r.Right:=left+width;
      r.Bottom:=top+height;
    end;procedure TForm1.Timer1Timer(Sender: TObject);
    var
      p:tpoint;
    begin
      getcursorpos(p);
      if(mousein)and(not(
        ((p.X>=r.Left) and (p.x<=r.Right))and((p.Y>=r.Top) and (p.y<=r.Bottom)))) then
        begin
          width:=5;
          r.Right:=r.Left+width;
          mousein:=false;
        end;
    end;
      

  5.   

    代码已经测试过了
    你试试var
      oldwidth:integer;
      mousein:boolean=true;
      r:trect;procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    begin
      if not mousein then
      begin
        width:=oldwidth;
        r.right:=r.Left+oldwidth;
      end;
      mousein:=true;
    end;
    procedure TForm1.FormShow(Sender: TObject);
    begin
      left:=0;
      oldwidth:=width;
      r.Left:=left;
      r.Top:=top;
      r.Right:=left+width;
      r.Bottom:=top+height;
      timer1.Interval:=1;
    end;procedure TForm1.Timer1Timer(Sender: TObject);
    var
      p:tpoint;
    begin
      getcursorpos(p);
      if(mousein)and(not(
        ((p.X>=r.Left) and (p.x<=r.Right))and((p.Y>=r.Top) and (p.y<=r.Bottom)))) then
        begin
          width:=5;
          r.Right:=r.Left+width;
          mousein:=false;
        end;
    end;
    procedure TForm1.FormCreate(Sender: TObject);
    begin
      borderstyle:=bsToolWindow;
    end;
      

  6.   

    首先FORM的属性要
    DragMode: dmAutomatic
    DragKind: dkDock其他的代码不知道