procedure TForm1.scGPLabel1MouseEnter(Sender: TObject);
begin
TControl(Sender).ShowHint := True;
end;
procedure TForm1.scGPLabel1MouseLeave(Sender: TObject);
begin
TControl(Sender).ShowHint := False;
end;
procedure TForm1.scGPLabel1MouseMove(Sender: TObject; Shift:
TShiftState; X, Y: Integer);
begin
FMyPosCurrPoint.X := mouse.CursorPos.X - X;
FMyPosCurrPoint.Y := mouse.CursorPos.y - Y;
Application.ActivateHint(FMyPosCurrPoint);
//想直接在这里控制,不知道怎么调试都不行。
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.HintPause := 0; //立即显示
Application.HintHidePause := 100000;
Screen.HintFont.Color := clred;
Screen.HintFont.Size := 9;
Application.OnShowHint := MyShowHint;
end;
procedure TForm1.MyShowHint(var HintStr: string; var CanShow: Boolean;
var HintInfo: THintInfo);
begin
dec(HintInfo.HintPos.y, HintInfo.HintControl.Height+27);
end;
Delphi 控制Hint显示位置
最新推荐文章于 2023-04-24 08:34:49 发布