Delphi中子窗体如何继承父窗体

来源:百度知道 编辑:UC知道 时间:2024/05/27 03:03:27
我做了一个图书馆管理系统,由于查询,删除,添加等数据库操作的代码都相似,我就建了一个父窗体,包含这些操作。我想建一个子窗体继承父窗体的这些操作,请问该如何实现?

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Form1{加上Form1};

type
TForm2 = class(TForm1{这里是Form1})
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.FormCreate(Sender: TObject);
begin
Form2.ButtonGet.Caption := '';
end;

也可以把查询、添加、删除等数据库操作做成函数,传递不同的参数。