通过窗体类方法创建并显示窗体
发布日期:2021-06-28 21:21:37 浏览次数:2 分类:技术文章

本文共 351 字,大约阅读时间需要 1 分钟。

在窗体类中增加类方法,通过该类方法创建并显示窗体,其他具有类似应用场景的类也可以通过相同的方法处理。

type

  TForm1 = class(TForm)
  private
    { Private declarations }
  public
    { Public declarations }
    class function ShowForm: Integer;
  end;

var

  Form1: TForm1;

implementation

{$R *.dfm}

class function TForm1.ShowForm: Integer;

begin
  with Self.Create(nil) do
  try
    Result := ShowModal;
  finally
    Free;
  end;
end;

end.

 

转载地址:https://blog.csdn.net/yanjinrong/article/details/107301485 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:调用时自动创建类对象
下一篇:类方法

发表评论

最新留言

能坚持,总会有不一样的收获!
[***.219.124.196]2024年04月05日 22时02分58秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章