generalpage.pas

来自「《Delphi COM深入编程》原书光盘」· PAS 代码 · 共 54 行

PAS
54
字号
unit GeneralPage;

interface

uses SysUtils, Windows, Messages, Classes, Graphics, Controls, StdCtrls,
  ExtCtrls, Forms, ComServ, ComObj, StdVcl, AxCtrls;

type
  TppgGeneral = class(TPropertyPage)
    Label1: TLabel;
    ecColumns: TEdit;
    cbSorted: TCheckBox;
    Label2: TLabel;
    ecTabWidth: TEdit;
  private
    { Private declarations }
  protected
    { Protected declarations }
  public
    { Public declarations }
    procedure UpdatePropertyPage; override;
    procedure UpdateObject; override;
  end;

const
  Class_ppgGeneral: TGUID = '{3774F17A-5D73-11D3-B872-0040F67455FE}';

implementation

{$R *.DFM}

procedure TppgGeneral.UpdatePropertyPage;
begin
  { Update your controls from OleObject }
  ecColumns.Text := IntToStr(OleObject.Columns);
  ecTabWidth.Text := IntToStr(OleObject.TabWidth);
  cbSorted.Checked := OleObject.Sorted;
end;

procedure TppgGeneral.UpdateObject;
begin
  { Update OleObject from your controls }
  OleObject.Columns := StrToInt(ecColumns.Text);
  OleObject.TabWidth := StrToInt(ecTabWidth.Text);
  OleObject.Sorted := cbSorted.Checked;
end;

initialization
  TActiveXPropertyPageFactory.Create(
    ComServer,
    TppgGeneral,
    Class_ppgGeneral);
end.

⌨️ 快捷键说明

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