我的意图是,让鼠标在image中任意移动,响应mousemove事件显示hint。
但是,现在只有第一次移入image时,显示hint;移到image的另一位置时,并不显示。
不过,当移到image的另一位置并且点击鼠标时,可以显示hint(但是我点击鼠标响应的是其他事件,并不是显示hint)
还有,当鼠标移出image,重新移进时,又可以显示hint,不过还是只显示一次。
请问怎么回事?
但是,现在只有第一次移入image时,显示hint;移到image的另一位置时,并不显示。
不过,当移到image的另一位置并且点击鼠标时,可以显示hint(但是我点击鼠标响应的是其他事件,并不是显示hint)
还有,当鼠标移出image,重新移进时,又可以显示hint,不过还是只显示一次。
请问怎么回事?
解决方案 »
- 如何实现 在 运行程序时 使 adoconnection 弹出 ADO 数据库 连接字符串生成器 , 并按照新的设置进行连接???
- 怎么能让窗体显示在最前面?
- 怎樣動態實例化不同的類。
- 高分求助将一组数据打乱的算法,random函数???高手请进!
- 如能解决,再加200分奉上......打开一个Delphi文件,出现如下错误提示.....急啊.
- IClock660無法上傳用戶資料
- com的问题
- 怎样获得 CPU的温度,电压,以及风扇转速 (up有分)
- 请问谁做过[施耐德]AndOver continuum系统的开发或使用?
- 诚征About窗体
- 请教一下,如何在控制台程序中使用tserversocket?
- 怎样得到局域网内用户所访问的网址
我需要的是,鼠标在image内移动,能多次显示hint。
不过这不能使提示标签随着鼠标的移动而移动
你要的这是种效果吗
刚刚登录不了
现在CSDN的表现还是不怎么样啊你试试用
procedure HintMouseMessage(Control: TControl; var Message: TMessage);
这个应该很烦的,我没试过,也不想试其实把HintHidePause的值设置得很大就可以了啊 方便实用
我想那个用户也不会把鼠标悬在Image上面一天不动吧
判断鼠标的位置,手式修改IMAGE的SHOWHINT 的属性或控制显示HINT
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.