做一个侧边栏,鼠标移到上面的时候显示,该怎么写啊?abf组件里面有吗?

解决方案 »

  1.   

    搞个panel就行了,记录一个当前状态,在鼠标移上去的时候,判断这个状态
      

  2.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, ComCtrls, ExtCtrls,Math, StdCtrls;type
      TForm1 = class(TForm)
        Timer1: TTimer;
        Label1: TLabel;
        procedure Timer1Timer(Sender: TObject);
      private
        FAnchors: TAnchors;
        procedure WMMOVING(var Msg: TMessage);message WM_MOVING;
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}
    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.Timer1Timer(Sender: TObject);
    const 
      cOffset = 2;
      begin
        if WindowFromPoint(Mouse.CursorPos) = 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.
      

  3.   

    这篇文章讲解改良TButton界面的方法,使其具有圆角和渐变背景图。
    这个DelphiDemos.zip中就是这个改良后的新按钮:TJHLButton
    完全源代码,欢迎下载。作者:金海龙(软件工程师)
    要想了解作者的权威程度,就用Google搜索‘金海龙’三个字。
    这篇文章节选自:Delphi高级组件开发指南 第一篇
    URL:http://www.docin.com/p-116784103.html按钮TJHLButton组件下载:DelphiDemos.zip 
    http://www.filefactory.com/file/b4he896/n/DelphiDemos.zip