baseframe.pas

来自「产品信息系统!关于产品基础信息的系统!功能强大!」· PAS 代码 · 共 64 行

PAS
64
字号
unit BaseFrame;

interface

uses 
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

type
  TBaseFrameF = class(TFrame)
  private
    FCaption: string;
    function GetModalResult: Integer;

    procedure SetModalResult(const Value: Integer);
    procedure SetCaption(const Value: string);
    { Private declarations }
  public
    function CanClose: Boolean; virtual;
    procedure Close;
    property ModalResult: Integer read GetModalResult write SetModalResult;
    property Caption: string read FCaption write SetCaption;
  end;

  TBaseFrameClass = class of TBaseFrameF;

implementation

{$R *.DFM}

{ TBaseFrameF }

function TBaseFrameF.CanClose: Boolean;
begin
  Result := True;
end;

procedure TBaseFrameF.Close;
begin
  if GetParentForm(Self) <> nil then
    GetParentForm(Self).Close;
end;

function TBaseFrameF.GetModalResult: Integer;
begin
  if GetParentForm(Self) <> nil then
    Result := GetParentForm(Self).ModalResult
  else Result := mrNone;
end;

procedure TBaseFrameF.SetCaption(const Value: string);
begin
  FCaption := Value;
  if GetParentForm(Self) <> nil then
    GetParentForm(Self).Caption := FCaption;
end;

procedure TBaseFrameF.SetModalResult(const Value: Integer);
begin
  if GetParentForm(Self) <> nil then
    GetParentForm(Self).ModalResult := Value;
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?