⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 expgridp.pas

📁 Delphi高级开发指南是开发程序的好帮手
💻 PAS
字号:
unit ExpGridP;

interface

uses
  Windows, Dialogs, Classes, SysUtils, ExptIntf, ToolIntf,
  VirtIntf, FileCtrl, Controls, ExpGForm, IStreams, ExpGResF;

type
  TGridExpertP = class (TIExpert)
  public
    function GetStyle: TExpertStyle; override;
    function GetName: string; override;
    function GetComment: string; override;
    function GetGlyph: HICON; override;
    function GetState: TExpertState; override;
    function GetIDString: string; override;
    function GetMenuText: string; override;
    function GetAuthor: string; override;
    function GetPage: string; override;
    procedure Execute; override;
  end;

  TGridFormExpertP = class (TGridExpert)
  public
    function GetStyle: TExpertStyle; override;
    function GetName: string; override;
    function GetIDString: string; override;
  end;

  procedure Register;

implementation

uses
  Buttons;

{$R GRIDICON.RES}

function TGridExpertP.GetStyle: TExpertStyle;
begin
  Result := esStandard;
end;
function TGridFormExpertP.GetStyle: TExpertStyle;
begin
  Result := esForm;
end;

function TGridExpertP.GetName: string;
begin
  Result := 'DDH Grid Expert (Proxi)'
end;
function TGridFormExpertP.GetName: string;
begin
  Result := 'DDH Grid Form Expert (Proxi)'
end;

function TGridExpertP.GetComment: string;
begin
  Result := 'String Grid Form Expert (Proxi)';
end;

function TGridExpertP.GetAuthor: string;
begin
  Result := 'Marco and Tim';
end;

function TGridExpertP.GetGlyph: HICON;
begin
  Result := LoadIcon (HInstance,
    MakeIntResource ('GRIDFORM'));
end;

function TGridExpertP.GetPage: string;
begin
  Result := 'Forms'; 
end;

function TGridExpertP.GetState: TExpertState;
begin
  Result := [esEnabled];
end;

function TGridExpertP.GetIDString: string;
begin
  Result := 'DDHandbook.GridStandardExpertP'
end;
function TGridFormExpertP.GetIDString: string;
begin
  Result := 'DDHandbook.GridFormExpertP'
end;

function TGridExpertP.GetMenuText: string;
begin
  Result := '&Grid Expert (Proxi)...'
end;

procedure TGridExpertP.Execute;
var
  FormName, UnitIdent, UnitFileName: string;
  FormIStream, UnitIStream: TIMemoryStream;
begin
  ToolServices.GetNewModuleName (
    UnitIdent, UnitFileName);
  FormName := 'Form' + Copy (UnitIdent, 5,
    Length (UnitIdent) - 4);
  // create and show the main form
  GridExpertPForm :=
    TGridExpertPForm.Create (Application);
  try
    // set the result form caption
    GridExpertPForm.EditCaption.Text := FormName;
    GridExpertPForm.EditUnit.Text := UnitIdent;
    if GridExpertPForm.ShowModal = idOK then
    begin
      // create the two interface streams
      FormIStream := TIMemoryStream.Create (GridExpertForm.StrForm);
      UnitIStream := TIMemoryStream.Create (GridExpertForm.StrUnit);
      // let them own the actual streams
      FormIStream.OwnStream := True;
      UnitIStream.OwnStream := True;
      // create the new module
      ToolServices.CreateModule (
        UnitFileName, UnitIStream, FormIStream,
        [cmAddToProject, cmShowSource, cmShowForm,
        cmUnnamed, cmMarkModified]);
    end;
  finally
    // free the main form
    GridExpertPForm.Free;
  end;
end;

procedure Register;
begin
  RegisterLibraryExpert(TGridExpert.Create);
  RegisterLibraryExpert(TGridFormExpert.Create);
end;

end.

⌨️ 快捷键说明

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