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

📄 unit1.pas.svn-base

📁 支持自定义语法高亮显示的编辑器控件
💻 SVN-BASE
字号:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls, EasyEditor, EasyEditSource, ComCtrls, StdCtrls;


type
  TMainForm = class(TForm)
    Panel1: TPanel;
    TreeView1: TTreeView;
    Panel: TPanel;
    procedure TreeView1Change(Sender: TObject; Node: TTreeNode);
    procedure FormCreate(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    procedure ShowDemoForms;
    procedure SetCurrentPanel(Value : TPanel);
    { Public declarations }
  end;

var
  MainForm: TMainForm;

const
  sPanels : array[0..13] of string = ('Features', 'Gutter\Margin', 'Page Type',
  'Word Wrap\Tabs', 'Background', 'Syntax Parsers', 'EasyEditor Dialogs', 'Printing and exporting',
  'EasyEditor Source', 'DB EasyEditor', 'Products', 'Dream Editor', 'Dream RichEditor',
  {'Scheduler',} 'Company Info');

implementation

uses
  unit2, EasySearchDlg, EasyReplDlg, EasyGoToDlg;
  
{$R *.DFM}

{---------------------------------------------------}


procedure TMainForm.FormCreate(Sender: TObject);
begin
  frmContainer := TfrmContainer.Create(Application);
  with TreeView1 do
    FullExpand;
end;

{---------------------------------------------------}

procedure TMainForm.SetCurrentPanel(Value : TPanel);
begin
  with Value do
  begin
    Parent := Panel;
    Align := alClient;
    BringToFront;
  end;
end;

{---------------------------------------------------}

procedure TMainForm.TreeView1Change(Sender: TObject;
  Node: TTreeNode);
begin
   ShowDemoForms;
end;

{---------------------------------------------------}


procedure TMainForm.ShowDemoForms;

  function CurrentPanel : integer;
  begin
    for result := Low(sPanels) to High(sPanels) do
      if CompareText(sPanels[result], TreeView1.Selected.Text) = 0 then
        Exit;
    result := - 1;
  end;

begin
  with frmContainer do
    case CurrentPanel  of
  //    1 : TreeView1.Selected := TreeView1.Items[1];
      1 : SetCurrentPanel(GutterMarginPanel);
      2 : SetCurrentPanel(PageTypePanel);
      3 : SetCurrentPanel(WrapPanel);
      4 : SetCurrentPanel(BackgroundPanel);
      5 : SetCurrentPanel(SyntaxParsersPanel);
      6 : SetCurrentPanel(EasyEditorDialogPanel);
      7 : SetCurrentPanel(PrintPanel);
      8 : SetCurrentPanel(EasyEditorSourcePanel);
      9 : SetCurrentPanel(DBEasyEditorPanel);
      11 : SetCurrentPanel(pnProject1);
      12 : SetCurrentPanel(pnProject2);
//      13 : SetCurrentPanel(pnProject3); //ShowMessage('Under Development');
      13 : SetCurrentPanel(CompanyPanel);
    end;
end;

{---------------------------------------------------}

procedure TMainForm.FormShow(Sender: TObject);
begin
  with TreeView1 do
    Selected := Items[1];
end;

{---------------------------------------------------}

procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
var
  i : integer;
begin
  for i := Panel.ControlCount - 1 downto 0 do
    Panel.Controls[i].Parent := nil;
end;

end.

⌨️ 快捷键说明

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