窗体上 有 若干已填写Hint值得控件。
求实现
当鼠标悬停至某个控件上方的时候,能将这个控件的hint信息
提交给同一窗体上的 一个 label的caption属性
谢谢 各位

解决方案 »

  1.   

    放一个Timer
    procedure TForm1.Timer1Timer(Sender: TObject);
    var p:TPoint;
        h:HWND;
    begin
      GetCursorPos(p);
      h:=WindowFromPoint(p);
      Label1.Caption:=FindControl(h).Hint;
    end;
      

  2.   

    楼上的方法可行将Timer的Interval设置小一点
      

  3.   

    最好加个判断procedure TForm1.Timer1Timer(Sender: TObject);
    var 
      p: TPoint;
      h: HWND;
    begin
      GetCursorPos(p);
      h := WindowFromPoint(p);
      if FindControl(h).ShowHint then Label1.Caption := FindControl(h).Hint;
    end;
      

  4.   

    type
      TForm1 = class(TForm)
        Label1: TLabel;
        ....................
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
        procedure OnDisplayHint(Sender: TObject);
      public
        { Public declarations }
      end;
    ................
    implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
    begin
      Application.OnHint := OnDisplayHint;
    end;procedure TForm1.OnDisplayHint(Sender: TObject);
    begin
       label1.Caption := GetLongHint(application.Hint);
    end;
      

  5.   

    在华丽的Additional页中有个华丽的ApplicationEvents控件~
    在华丽的ApplicationEvents空间的Event中有一个华丽的OnHint~
    把这句写进去就行鸟~
    label1.Caption := GetLongHint(application.Hint);
      

  6.   

    如果要对Hint内容做一些操作~
    可以写在ApplicationEvents的OnShowHint中~
    procedure TForm1.ApplicationEvents1ShowHint(var HintStr: string;
      var CanShow: Boolean; var HintInfo: THintInfo);
    其中HintStr为Hint的内容~
    CanShow改为False就不出现Hint~
    HintInfo为Hint的相关信息~
    THintInfo类定义在Forms单元~
    看着办吧~
     THintInfo = record
        HintControl: TControl;
        HintWindowClass: THintWindowClass;
        HintPos: TPoint;
        HintMaxWidth: Integer;
        HintColor: TColor;
        CursorRect: TRect;
        CursorPos: TPoint;
        ReshowTimeout: Integer;
        HideTimeout: Integer;
        HintStr: string;
        HintData: Pointer;
      end;
      

  7.   

    捕捉鼠标,激活事件,判断位置,属性,获取HINT信息,发消息到LABEL,显示出来。