我的意图是,让鼠标在image中任意移动,响应mousemove事件显示hint。
但是,现在只有第一次移入image时,显示hint;移到image的另一位置时,并不显示。
不过,当移到image的另一位置并且点击鼠标时,可以显示hint(但是我点击鼠标响应的是其他事件,并不是显示hint)
还有,当鼠标移出image,重新移进时,又可以显示hint,不过还是只显示一次。
请问怎么回事?

解决方案 »

  1.   

    这好象是一般hint的特性, 不如改用THintWindow对象吧, 手工控制它!
      

  2.   

    设置HintHidePause属性没有用,它只是决定Hint显示的时间。
    我需要的是,鼠标在image内移动,能多次显示hint。
      

  3.   

    把HintHidePause的值设置比较大也可以啊
    不过这不能使提示标签随着鼠标的移动而移动
    你要的这是种效果吗
      

  4.   

    啊呀呀 ~~
    刚刚登录不了
    现在CSDN的表现还是不怎么样啊你试试用
    procedure HintMouseMessage(Control: TControl; var Message: TMessage);
    这个应该很烦的,我没试过,也不想试其实把HintHidePause的值设置得很大就可以了啊 方便实用
    我想那个用户也不会把鼠标悬在Image上面一天不动吧
      

  5.   

    仅思路:
    判断鼠标的位置,手式修改IMAGE的SHOWHINT 的属性或控制显示HINT
      

  6.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      ExtCtrls;type
      TForm1 = class(TForm)
        Timer1: TTimer;
        Image1: TImage;
        procedure Timer1Timer(Sender: TObject);
        procedure FormCreate(Sender: TObject);
        procedure FormDestroy(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;Const
      HintMsgHeight = 18;
      HintMsgWidth = 100;
      MyCursorHeight = 20;
      FormTitleHeight = 22;
      FormBorderWidth = 3;
    var
      Form1: TForm1;
      MyHW : THintWindow;
      PreviousPt : TPoint;implementation{$R *.DFM}
    procedure TForm1.Timer1Timer(Sender: TObject);
    var
      pt : TPoint;
    begin
      GetCursorPos(pt);    // Retrieve Cursor postion.
      if not ((PreviousPt.x = pt.x) and (PreviousPt.y = pt.y)) then   // Avoid Refresh.
      begin
        PreviousPt.x := pt.x;        // Restore X to previous point.
        PreviousPt.y := pt.y;        // Restore Y to previous point.
        if (Pt.x > Left + image1.Left + FormBorderWidth) and
           (pt.y > Top + Image1.top + FormTitleHeight) and
           (pt.x < Left + Image1.Left + image1.width + FormBorderWidth) and
           (pt.y < Top + Image1.top + Image1.height + FormTitleHeight) then
          MyHw.ActivateHint (Rect(pt.x, pt.y + MyCursorHeight, pt.x + HintMsgWidth,
            pt.y + HintMsgHeight+ MyCursorHeight),'Hello')  // if in Image box then show Hint.
        else
          MyHw.ActivateHint (Rect(-1,-1,0,0),'');  // Out of Image box then hide hint.
      end;
    end;procedure TForm1.FormCreate(Sender: TObject);
    begin
      MyHW := ThintWindow.Create (Self);
      Image1.Picture.LoadFromFile ('C:\Program Files\Common Files\Borland Shared\Images\Backgrnd\calendar.bmp');
      Timer1.Interval := 300;
    end;procedure TForm1.FormDestroy(Sender: TObject);
    begin
      MyHW.free;
    end;end.