atmplvdc.pas

来自「delphi编程控件」· PAS 代码 · 共 71 行

PAS
71
字号
unit atmplvdc;
(*
 COPYRIGHT (c) RSD Software 1997 - 98
 All Rights Reserved.
*)

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  DBCtrls, StdCtrls, ExtCtrls, DB, adbtempl;

type
  TFRepositoryViewDefControl = class(TForm)
    Panel1: TPanel;
    BClose: TButton;
    DBNavigator: TDBNavigator;
    Panel: TPanel;
    DataSource: TDataSource;
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    DBControl : TWinControl;
  public
    { Public declarations }
  end;

procedure ShowAutoDefField(ADefField : TAutoDefField);

implementation
uses autostrs, audbstrs;
{$R *.DFM}

procedure ShowAutoDefField(ADefField : TAutoDefField);
Var
  AForm : TFRepositoryViewDefControl;
begin
  AForm := TFRepositoryViewDefControl.Create(Nil);
  with AForm do begin
    if(ADefField <> Nil) And (ADefField.Field <> Nil) then begin
      DataSource.DataSet := ADefField.Field.DataSet;
      DBControl := ADefField.DBDefControl.CreateDBControl(Panel, DataSource, ADefField.Field.FieldName);
      if(DBControl <> Nil) then begin
        DBControl.SetBounds((Panel.Width - DBControl.Width) div 2,
          (Panel.Height - DBControl.Height) div 2,  DBControl.Width, DBControl.Height);
        DBControl.Visible := True;
      end;
    end;
    ShowModal;
    if(DBControl <> Nil) then
      ADefField.DBDefControl.DestroyControl(DBControl);
  end;
  AForm.Free;
end;


procedure TFRepositoryViewDefControl.FormCreate(Sender: TObject);
begin
  BClose.Caption := LoadStr(ACB_CLOSE);
  Caption := LoadStr(ACDB_REPOSVIEWDEFCONTROLCAPTION);
end;

procedure TFRepositoryViewDefControl.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  if(DataSource.DataSet <> Nil) and DataSource.DataSet.Modified then
    DataSource.DataSet.Cancel;
end;

end.

⌨️ 快捷键说明

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