这个太简单,我以前用vb作过这样的效果,当鼠标离开窗体的时候设置窗体的top属性就可以了
比如:form1的高为100,并且在屏幕最上方,你就可以设置她的top为-90,这样她就缩上去了,当你想让他下来的时候把top改回来就可以了。
怎么样?接分!!!

解决方案 »

  1.   

    逛逛书店
    有专门介绍delphi特效的
      

  2.   

    参考MSDN的ShellAPI的Application Band的内容,介绍如何在桌面上定制一个自己的任务栏的内容。这样做比较符合常规。
      

  3.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ExtCtrls;type
      TForm1 = class(TForm)
        Timer1: TTimer;
        Memo1: TMemo;
        procedure FormCreate(Sender: TObject);
        procedure Timer1Timer(Sender: TObject);
      private
        { Private declarations }
        FAnchors: TAnchors;
        procedure WMMOVING(var Msg: TMessage); message WM_MOVING;
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}uses Math;procedure TForm1.WMMOVING(var Msg: TMessage);
    begin
      inherited;
      with PRect(Msg.LParam)^ do begin
        Left := Min(Max(0, Left), Screen.Width - Width);
        Top := Min(Max(0, Top), Screen.Height - Height);
        Right := Min(Max(Width, Right), Screen.Width);
        Bottom := Min(Max(Height, Bottom), Screen.Height);
        FAnchors := [];
        if Left = 0 then Include(FAnchors, akLeft);
        if Right = Screen.Width then Include(FAnchors, akRight);
        if Top = 0 then Include(FAnchors, akTop);
        if Bottom = Screen.Height then Include(FAnchors, akBottom);
        Timer1.Enabled := FAnchors <> [];
      end;
    end;procedure TForm1.FormCreate(Sender: TObject);
    begin
      Timer1.Enabled := False;
      Timer1.Interval := 200;
      FormStyle := fsStayOnTop;
    end;procedure TForm1.Timer1Timer(Sender: TObject);
    const
      cOffset = 2;
    var
      vHandle: THandle;
    begin
      vHandle := WindowFromPoint(Mouse.CursorPos);
      while (vHandle <> 0) and (vHandle <> Handle) do
        vHandle := GetParent(vHandle);
      if vHandle = Handle then begin
        if akLeft in FAnchors then Left := 0;
        if akTop in FAnchors then Top := 0;
        if akRight in FAnchors then Left := Screen.Width - Width;
        if akBottom in FAnchors then Top := Screen.Height - Height;
      end else begin
        if akLeft in FAnchors then Left := -Width + cOffset;
        if akTop in FAnchors then Top := -Height + cOffset;
        if akRight in FAnchors then Left := Screen.Width - cOffset;
        if akBottom in FAnchors then Top := Screen.Height - cOffset;
      end;
    end;end.