unit1.~pas

来自「delphi 中用于 css 样式表的解析的类」· ~PAS 代码 · 共 57 行

~PAS
57
字号
unit Unit1;

// (C) 2005 MYTHcode.org

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, ToolWin, SubUtils,CSSParser;

type
  TForm1 = class(TForm)
    ToolBar1: TToolBar;
    ToolButton1: TToolButton;
    OpenDialog1: TOpenDialog;
    TreeView1: TTreeView;
    procedure ToolButton1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.ToolButton1Click(Sender: TObject);
var
  Parser: TCSSParser;
  ParentNode: TTreeNode;
  s:integer;
begin
 if OpenDialog1.Execute then
 begin
   Parser:=TCSSParser.Create(File_(OpenDialog1.FileName));
   try
     ParentNode:=nil;
     with Parser, TreeView1.Items do
     while Next do
     case ItemType of
       itHead: ParentNode:=AddChild(nil, Parser.Item);
       itSimple, itLast: AddChild(ParentNode, Parser.Item);
       itComment: AddChild(ParentNode, '//'+Parser.Item);
     end;
     Parser.
   finally
     Parser.Free;
   end;
 end;
end;

end.

⌨️ 快捷键说明

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