Delphi XE的Hint显示问题

资料来源别处,谢谢

Application.HintHidePause:=30000;//显示多久隐藏

HintHidePause,HintPause,HintShortPause,控制着提示窗显示的时间等。HintHidePause指定提示窗口在屏幕上显示的时间,以毫秒为单位。HintPause则指定当你将光标移到有提示的控件上时,经过多长时间才会出现提示窗口,以毫秒为单位。而 HintShortPause呢表示当你快速移动光标经过一组有Hint的控件时,显示Hint的间隔。比如有两个有Hint的控钮,当你的光标快速从 Btn1移到Btn2时,Hint经过HintShortPause毫秒才会显示出来。

------------以下

环境是XE的,D7的正常,XE的不正常!

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
procedure Sshowhint(var hintstr:string;var canshow:Boolean;var HintInfo:THintInfo);
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
form1.Hint:= '改变提示栏';
form1.ShowHint:=true;
Application.HintColor:=TColor(255);//红色不起作用 //TColor(16711680) 蓝色;
Application.OnShowHint:= Sshowhint;
Screen.HintFont.Color := clred;
Screen.HintFont.Size := 14;

end;


procedure TForm1.Sshowhint(var hintstr:string; var canshow: Boolean;
var HintInfo: THintInfo);
var
i:integer;
begin
for i:=0 to Application.ComponentCount-1 do
if Application.Components[i] is THintWindow then
with THintWindow(Application.Components[i]).Canvas do
begin
Font.Name := '隶书';
Font.Size := 18;
Font.Color:=clred; //不起作用
HintInfo.HintColor := clred; //clskyblue; //不起作用
THintWindow(Application.Components[i]).Color := clred; //不起作用
end;
end;
end.

原文地址:https://www.cnblogs.com/dmqhjp/p/14292971.html