我在使用Application.ActivateHint时缺少什么?

时间:2019-05-27 20:08:13

标签: delphi delphi-xe2 vcl

我正在尝试在按钮中使用Application.ActivateHint来显示其提示。
根本不起作用,目标按钮中没有任何提示。
表单之外没有任何容器。

procedure TForm1.btn2Click(Sender: TObject);
var 
  PosScr1: TPoint;
  Btn_Test: TButton;

begin
  Btn_Test := nil;

  Btn_Test := TButton(Self.FindComponent('Btn_Test'));
  if not Assigned(Btn_Test) then
  begin
    // Generated by GExperts "Component to Code"
    // To clone the original target button 
    // and leave the method self-suficient for
    // StackOverflow
    Btn_Test := TButton.Create(Self);
    with Btn_Test do
    begin
      Name := 'Btn_Test';
      Parent := Self;
      Left := 176;
      Top := 56;
      Width := 75;
      Height := 25;
      Hint := 'Testing';
      Caption := 'Btn_Test';
      ParentShowHint := False;
      ShowHint := True;
      TabOrder := 0;
    end;
    //***********************
  end;

  PosScr1 := ClientToScreen(Btn_Test.BoundsRect.TopLeft);
  Application.ActivateHint(PosScr1);  
end;

0 个答案:

没有答案
相关问题