第39题):delphi的帮助怎么也错了?
public
procedure DoShowHint(var HintStr: WideString; var CanShow: Boolean; var HintInfo: THintInfo);
end;
......
procedure TForm1.DoShowHint(var HintStr: WideString; var CanShow: Boolean; var HintInfo: THintInfo);
begin
if HintInfo.HintControl = SpeedButton3 then
begin
with HintInfo do
begin
HintColor := clAqua;
HintMaxWidth := 120;
Inc(HintPos.X, SpeedButton3.Width);
end;
end;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
Application.ShowHint := True;
Application.OnShowHint := DoShowHint;//错误停在这一行
//编译说:[Error] Unit1.pas(47): Incompatible types: 'String' and 'WideString'end;
2)另外偶想在建立动态菜单,并在ondrawitem中写代码
让鼠标在移动到menuitem中时显示黄色提示窗口,移出后黄色提示窗口消失
但HintInfo.HintControl 只支持tcontrol 而menuitem是继承至tcomponent
,请问如何才能实现?
根据帮助偶用thintwindow写了,但有个很恶心问题:当鼠标移动速度太快
,黄色提示窗口就会拼命闪烁无法消失,怎么解决?
public
procedure DoShowHint(var HintStr: WideString; var CanShow: Boolean; var HintInfo: THintInfo);
end;
......
procedure TForm1.DoShowHint(var HintStr: WideString; var CanShow: Boolean; var HintInfo: THintInfo);
begin
if HintInfo.HintControl = SpeedButton3 then
begin
with HintInfo do
begin
HintColor := clAqua;
HintMaxWidth := 120;
Inc(HintPos.X, SpeedButton3.Width);
end;
end;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
Application.ShowHint := True;
Application.OnShowHint := DoShowHint;//错误停在这一行
//编译说:[Error] Unit1.pas(47): Incompatible types: 'String' and 'WideString'end;
2)另外偶想在建立动态菜单,并在ondrawitem中写代码
让鼠标在移动到menuitem中时显示黄色提示窗口,移出后黄色提示窗口消失
但HintInfo.HintControl 只支持tcontrol 而menuitem是继承至tcomponent
,请问如何才能实现?
根据帮助偶用thintwindow写了,但有个很恶心问题:当鼠标移动速度太快
,黄色提示窗口就会拼命闪烁无法消失,怎么解决?
TForm1.DoShowHint(var HintStr: string; var CanShow: Boolean; var HintInfo: THintInfo);
-------------因为TShowHintEvent类型要求的函数原型的第一个参数是一个String类型的引用参数,而不是WideString类型的引用参数。第二个问题,没有看到你的代码,所以无法解答。